small Lua code optimization