MCPcopy Create free account
hub / github.com/ObEngine/ObEngine / createmetatable

Function createmetatable

extlibs/lua/src/lstrlib.c:1783–1794  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1781
1782
1783static void createmetatable (lua_State *L) {
1784 /* table to be metatable for strings */
1785 luaL_newlibtable(L, stringmetamethods);
1786 luaL_setfuncs(L, stringmetamethods, 0);
1787 lua_pushliteral(L, ""); /* dummy string */
1788 lua_pushvalue(L, -2); /* copy table */
1789 lua_setmetatable(L, -2); /* set table as metatable for strings */
1790 lua_pop(L, 1); /* pop dummy string */
1791 lua_pushvalue(L, -2); /* get string library */
1792 lua_setfield(L, -2, "__index"); /* metatable.__index = string */
1793 lua_pop(L, 1); /* pop metatable */
1794}
1795
1796
1797/*

Callers 1

luaopen_stringFunction · 0.85

Calls 4

lua_pushvalueFunction · 0.85
lua_setmetatableFunction · 0.85
lua_setfieldFunction · 0.85
luaL_setfuncsFunction · 0.70

Tested by

no test coverage detected