MCPcopy Create free account
hub / github.com/WaykiChain/WaykiChain / lua_setglobal

Function lua_setglobal

src/vm/luavm/lua/lapi.c:723–734  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

721
722
723LUA_API void lua_setglobal (lua_State *L, const char *name) {
724 Table *reg = hvalue(&G(L)->l_registry);
725 const TValue *gt; /* global table */
726 lua_lock(L);
727 api_checknelems(L, 1);
728 gt = luaH_getint(reg, LUA_RIDX_GLOBALS);
729 setsvalue2s(L, L->top, luaS_new(L, name));
730 api_incr_top(L);
731 luaV_settable(L, gt, L->top - 1, L->top - 2);
732 L->top -= 2; /* pop value and key */
733 lua_unlock(L);
734}
735
736
737LUA_API void lua_settable (lua_State *L, int idx) {

Callers 5

RunMethod · 0.85
createargtableFunction · 0.85
dolibraryFunction · 0.85
luaL_requirefFunction · 0.85
luaopen_tableFunction · 0.85

Calls 3

luaH_getintFunction · 0.85
luaS_newFunction · 0.85
luaV_settableFunction · 0.85

Tested by

no test coverage detected