some codes written in Lua