MCPcopy Create free account
hub / github.com/F-Stack/f-stack / luaL_newmetatable

Function luaL_newmetatable

freebsd/contrib/openzfs/module/lua/lauxlib.c:232–241  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

230*/
231
232LUALIB_API int luaL_newmetatable (lua_State *L, const char *tname) {
233 luaL_getmetatable(L, tname); /* try to get metatable */
234 if (!lua_isnil(L, -1)) /* name already in use? */
235 return 0; /* leave previous value on top, but return 0 */
236 lua_pop(L, 1);
237 lua_newtable(L); /* create metatable */
238 lua_pushvalue(L, -1);
239 lua_setfield(L, LUA_REGISTRYINDEX, tname); /* registry.name = metatable */
240 return 1;
241}
242
243
244LUALIB_API void luaL_setmetatable (lua_State *L, const char *tname) {

Callers 1

zcp_load_list_libFunction · 0.50

Calls 2

lua_pushvalueFunction · 0.70
lua_setfieldFunction · 0.70

Tested by

no test coverage detected