Skip to content

Commit

Permalink
Cleanup LuaImage.
Browse files Browse the repository at this point in the history
  • Loading branch information
zhenliang committed May 29, 2011
1 parent e2476c8 commit 16766bd
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion engine/image_mgr_lua.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ int GetImage(lua_State* L)
std::string key = lua_tostring(L, 1);

#if 1
Image** boxptr = static_cast<Image**>(lua_newuserdata(L, sizeof(Image*)));
Image** boxptr = static_cast<Image**>(lua_newuserdata(L, sizeof(void*)));
*boxptr = &ImageManager::GetInstance().GetImage(key);
#else // lua_boxpointer
Image* image = &ImageManager::GetInstance().GetImage(key);
Expand Down Expand Up @@ -71,17 +71,21 @@ void LuaImage::Register(lua_State* L)
luaL_newmetatable(L, className_);
int metaTable = lua_gettop(L);

#if 0
lua_pushstring(L, "__metatable");
lua_pushvalue(L, methodTable);
lua_settable(L, metaTable);
#endif

lua_pushstring(L, "__index");
lua_pushvalue(L, methodTable);
lua_settable(L, metaTable);

#if 0
lua_pushstring(L, "__gc");
lua_pushcfunction(L, LuaImage::GC);
lua_settable(L, metaTable);
#endif

lua_pop(L, 1); // drop metatable
luaL_register(L, NULL, LuaImage::methods_); // fill methodtable
Expand Down

0 comments on commit 16766bd

Please sign in to comment.