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

Function createmetatable

freebsd/contrib/openzfs/module/lua/lstrlib.c:1014–1023  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1012
1013
1014static void createmetatable (lua_State *L) {
1015 lua_createtable(L, 0, 1); /* table to be metatable for strings */
1016 lua_pushliteral(L, ""); /* dummy string */
1017 lua_pushvalue(L, -2); /* copy table */
1018 lua_setmetatable(L, -2); /* set table as metatable for strings */
1019 lua_pop(L, 1); /* pop dummy string */
1020 lua_pushvalue(L, -2); /* get string library */
1021 lua_setfield(L, -2, "__index"); /* metatable.__index = string */
1022 lua_pop(L, 1); /* pop metatable */
1023}
1024
1025
1026/*

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