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

Function createmetatable

third-party/lua-5.2.4/src/lstrlib.c:999–1008  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

997
998
999static void createmetatable (lua_State *L) {
1000 lua_createtable(L, 0, 1); /* table to be metatable for strings */
1001 lua_pushliteral(L, ""); /* dummy string */
1002 lua_pushvalue(L, -2); /* copy table */
1003 lua_setmetatable(L, -2); /* set table as metatable for strings */
1004 lua_pop(L, 1); /* pop dummy string */
1005 lua_pushvalue(L, -2); /* get string library */
1006 lua_setfield(L, -2, "__index"); /* metatable.__index = string */
1007 lua_pop(L, 1); /* pop metatable */
1008}
1009
1010
1011/*

Callers 1

luaopen_stringFunction · 0.70

Calls 4

lua_createtableFunction · 0.70
lua_pushvalueFunction · 0.70
lua_setmetatableFunction · 0.70
lua_setfieldFunction · 0.70

Tested by

no test coverage detected