MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / luaB_setmetatable

Function luaB_setmetatable

deps/lua/src/lbaselib.c:104–114  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

102
103
104static int luaB_setmetatable (lua_State *L) {
105 int t = lua_type(L, 2);
106 luaL_checktype(L, 1, LUA_TTABLE);
107 luaL_argcheck(L, t == LUA_TNIL || t == LUA_TTABLE, 2,
108 "nil or table expected");
109 if (luaL_getmetafield(L, 1, "__metatable"))
110 luaL_error(L, "cannot change a protected metatable");
111 lua_settop(L, 2);
112 lua_setmetatable(L, 1);
113 return 1;
114}
115
116
117static void getfunc (lua_State *L, int opt) {

Callers

nothing calls this directly

Calls 6

lua_typeFunction · 0.85
luaL_checktypeFunction · 0.85
luaL_getmetafieldFunction · 0.85
luaL_errorFunction · 0.85
lua_settopFunction · 0.85
lua_setmetatableFunction · 0.85

Tested by

no test coverage detected