LUA String mangling: trim a string

November 23, 2007 | Add a comment »

Here’s a usefull function to trim (remove leading and/or trailing spaces) a string

function trim (s)
	return (string.gsub(s, "^%s*(.-)%s*$", "%1"))
end

Lua Short Reference

July 12, 2006 | Add a comment »

Head over to http://lua-users.org/wiki/LuaShortReference to get yourself a nicely written summary of the Lua syntax and core libraries by Enrico Colombini.