Generate Lua code