Converted ugly C++/GLua to Lua.