strip = function(test) comment = test.indexOf("#") if comment == null then comment = test.indexOf(";") if comment then test = test[:comment] while test[-1] == " " test = test - " " end while return test end function print strip("This is a hash test # a comment") + "." print strip("This is a semicolon test ; a comment") + "." print strip("This is a no comment test ") + "."