MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / createmetatable

Function createmetatable

lib/lua/src/lstrlib.c:1852–1863  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1850
1851
1852static void createmetatable (lua_State *L) {
1853 /* table to be metatable for strings */
1854 luaL_newlibtable(L, stringmetamethods);
1855 luaL_setfuncs(L, stringmetamethods, 0);
1856 lua_pushliteral(L, ""); /* dummy string */
1857 lua_pushvalue(L, -2); /* copy table */
1858 lua_setmetatable(L, -2); /* set table as metatable for strings */
1859 lua_pop(L, 1); /* pop dummy string */
1860 lua_pushvalue(L, -2); /* get string library */
1861 lua_setfield(L, -2, "__index"); /* metatable.__index = string */
1862 lua_pop(L, 1); /* pop metatable */
1863}
1864
1865
1866/*

Callers 1

luaopen_stringFunction · 0.85

Calls 4

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

Tested by

no test coverage detected