static int l_map_set_sheet(lua_State *L) { THMap* pMap = luaT_testuserdata<THMap>(L); THSpriteSheet* pSheet = luaT_testuserdata<THSpriteSheet>(L, 2); lua_settop(L, 2); pMap->setBlockSheet(pSheet); luaT_setenvfield(L, 1, "sprites"); return 1; }
static int l_map_depersist(lua_State *L) { THMap* pMap = luaT_testuserdata<THMap>(L); lua_settop(L, 2); lua_insert(L, 1); LuaPersistReader* pReader = (LuaPersistReader*)lua_touserdata(L, 1); pMap->depersist(pReader); luaT_getenvfield(L, 2, "sprites"); pMap->setBlockSheet((THSpriteSheet*)lua_touserdata(L, -1)); lua_pop(L, 1); return 0; }