MCPcopy Create free account
hub / github.com/EmmyLua/EmmyLuaDebugger / auxsetstr

Function auxsetstr

third-party/lua-5.5.0/src/lapi.c:859–875  ·  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

857** t[k] = value at the top of the stack (where 'k' is a string)
858*/
859static void auxsetstr (lua_State *L, const TValue *t, const char *k) {
860 int hres;
861 TString *str = luaS_new(L, k);
862 api_checkpop(L, 1);
863 luaV_fastset(t, str, s2v(L->top.p - 1), hres, luaH_psetstr);
864 if (hres == HOK) {
865 luaV_finishfastset(L, t, s2v(L->top.p - 1));
866 L->top.p--; /* pop value */
867 }
868 else {
869 setsvalue2s(L, L->top.p, str); /* push 'str' (to make it a TValue) */
870 api_incr_top(L);
871 luaV_finishset(L, t, s2v(L->top.p - 1), s2v(L->top.p - 2), hres);
872 L->top.p -= 2; /* pop value and key */
873 }
874 lua_unlock(L); /* lock done by caller */
875}
876
877
878LUA_API void lua_setglobal (lua_State *L, const char *name) {

Callers 2

lua_setglobalFunction · 0.70
lua_setfieldFunction · 0.70

Calls 2

luaS_newFunction · 0.70
luaV_finishsetFunction · 0.70

Tested by

no test coverage detected