MCPcopy Create free account
hub / github.com/DFHack/dfhack / auxsetstr

Function auxsetstr

depends/lua/src/lapi.c:743–756  ·  view source on GitHub ↗

** t[k] = value at the top of the stack (where 'k' is a string) */

Source from the content-addressed store, hash-verified

741** t[k] = value at the top of the stack (where 'k' is a string)
742*/
743static void auxsetstr (lua_State *L, const TValue *t, const char *k) {
744 const TValue *slot;
745 TString *str = luaS_new(L, k);
746 api_checknelems(L, 1);
747 if (luaV_fastset(L, t, str, slot, luaH_getstr, L->top - 1))
748 L->top--; /* pop value */
749 else {
750 setsvalue2s(L, L->top, str); /* push 'str' (to make it a TValue) */
751 api_incr_top(L);
752 luaV_finishset(L, t, L->top - 1, L->top - 2, slot);
753 L->top -= 2; /* pop value and key */
754 }
755 lua_unlock(L); /* lock done by caller */
756}
757
758
759LUA_API void lua_setglobal (lua_State *L, const char *name) {

Callers 2

lua_setglobalFunction · 0.85
lua_setfieldFunction · 0.85

Calls 2

luaS_newFunction · 0.85
luaV_finishsetFunction · 0.85

Tested by

no test coverage detected