MCPcopy Create free account
hub / github.com/EmmyLua/EmmyLuaDebugger / luaL_newmetatable

Function luaL_newmetatable

third-party/lua-5.1.5/src/lauxlib.c:112–121  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

110
111
112LUALIB_API int luaL_newmetatable (lua_State *L, const char *tname) {
113 lua_getfield(L, LUA_REGISTRYINDEX, tname); /* get registry.name */
114 if (!lua_isnil(L, -1)) /* name already in use? */
115 return 0; /* leave previous value on top, but return 0 */
116 lua_pop(L, 1);
117 lua_newtable(L); /* create metatable */
118 lua_pushvalue(L, -1);
119 lua_setfield(L, LUA_REGISTRYINDEX, tname); /* registry.name = metatable */
120 return 1;
121}
122
123
124LUALIB_API void *luaL_checkudata (lua_State *L, int ud, const char *tname) {

Callers 2

luaopen_packageFunction · 0.70
createmetaFunction · 0.70

Calls 3

lua_getfieldFunction · 0.70
lua_pushvalueFunction · 0.70
lua_setfieldFunction · 0.70

Tested by

no test coverage detected