lua api - Lua C API: Delete metatable created with luaL_newmetatable? -


how can delete metatable foo created lual_newmetatable( l, "foo" );, lual_getmetatable( l, "foo" ); push nil value again?

whatever reason may have delete metatable, possible. lual_newmetatable(l, "foo") creates table, stored in lua registry key "foo".

to delete table, set field "foo" in registry nil. code in c:

lua_pushnil(l); lua_setfield(l, lua_registryindex, "foo"); 

equivalent code in lua:

debug.getregistry()["foo"] = nil 

Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -