** t[k] = value at the top of the stack (where 'k' is a string) */
| 786 | ** t[k] = value at the top of the stack (where 'k' is a string) |
| 787 | */ |
| 788 | static 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 | |
| 806 | LUA_API void lua_setglobal (lua_State *L, const char *name) { |
no test coverage detected