All pastes #804505 Raw Edit

Metatable

public text v1 · immutable
·published 2007-12-03 15:16 UTC
rendered paste body
lua_newtable(sl_gstate); // the global metatable
	lua_pushcfunction(sl_gstate, typel_mtindex);
	lua_setfield(sl_gstate, -2, "__index");
	lua_pushcfunction(sl_gstate, typel_mtnewindex);
	lua_setfield(sl_gstate, -2, "__newindex");
	lua_pushcfunction(sl_gstate, typel_mtgc);
	lua_setfield(sl_gstate, -2, "__gc");
	typel_mtref = luaL_ref(sl_gstate, LUA_REGISTRYINDEX);