How can I delete a metatable foo created with luaL_newmetatable( L, "foo" );, so that luaL_getmetatable( L, "foo" ); will push a NIL value again?
Lua C API: Delete metatable created with luaL_newmetatable?
1.1k views Asked by Larpi At
1
Whatever the reason you may have to delete the metatable, it is possible.
luaL_newmetatable(L, "foo")creates a table, which is stored in the Lua registry with the key"foo".To delete the table, just set the field
"foo"in the registry tonil. The code in C:Equivalent code in Lua: