MCPcopy Create free account
hub / github.com/ObEngine/ObEngine / auxsetstr

Function auxsetstr

extlibs/lua/src/lapi.c:788–803  ·  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

786** t[k] = value at the top of the stack (where 'k' is a string)
787*/
788static void auxsetstr (lua_State *L, const TValue *t, const char *k) {
789 const TValue *slot;
790 TString *str = luaS_new(L, k);
791 api_checknelems(L, 1);
792 if (luaV_fastget(L, t, str, slot, luaH_getstr)) {
793 luaV_finishfastset(L, t, slot, s2v(L->top - 1));
794 L->top--; /* pop value */
795 }
796 else {
797 setsvalue2s(L, L->top, str); /* push 'str' (to make it a TValue) */
798 api_incr_top(L);
799 luaV_finishset(L, t, s2v(L->top - 1), s2v(L->top - 2), slot);
800 L->top -= 2; /* pop value and key */
801 }
802 lua_unlock(L); /* lock done by caller */
803}
804
805
806LUA_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