MCPcopy Create free account
hub / github.com/ArduPilot/ardupilot / createmetatable

Function createmetatable

libraries/AP_Scripting/lua/src/lstrlib.c:1571–1580  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1569
1570
1571static void createmetatable (lua_State *L) {
1572 lua_createtable(L, 0, 1); /* table to be metatable for strings */
1573 lua_pushliteral(L, ""); /* dummy string */
1574 lua_pushvalue(L, -2); /* copy table */
1575 lua_setmetatable(L, -2); /* set table as metatable for strings */
1576 lua_pop(L, 1); /* pop dummy string */
1577 lua_pushvalue(L, -2); /* get string library */
1578 lua_setfield(L, -2, "__index"); /* metatable.__index = string */
1579 lua_pop(L, 1); /* pop metatable */
1580}
1581
1582
1583/*

Callers 1

luaopen_stringFunction · 0.85

Calls 4

lua_createtableFunction · 0.85
lua_pushvalueFunction · 0.85
lua_setmetatableFunction · 0.85
lua_setfieldFunction · 0.85

Tested by

no test coverage detected