** t[k] = value at the top of the stack (where 'k' is a string) */
| 821 | ** t[k] = value at the top of the stack (where 'k' is a string) |
| 822 | */ |
| 823 | static void auxsetstr (lua_State *L, const TValue *t, const char *k) { |
| 824 | const TValue *slot; |
| 825 | TString *str = luaS_new(L, k); |
| 826 | api_checknelems(L, 1); |
| 827 | if (luaV_fastget(L, t, str, slot, luaH_getstr)) { |
| 828 | luaV_finishfastset(L, t, slot, s2v(L->top - 1)); |
| 829 | L->top--; /* pop value */ |
| 830 | } |
| 831 | else { |
| 832 | setsvalue2s(L, L->top, str); /* push 'str' (to make it a TValue) */ |
| 833 | api_incr_top(L); |
| 834 | luaV_finishset(L, t, s2v(L->top - 1), s2v(L->top - 2), slot); |
| 835 | L->top -= 2; /* pop value and key */ |
| 836 | } |
| 837 | lua_unlock(L); /* lock done by caller */ |
| 838 | } |
| 839 | |
| 840 | |
| 841 | LUA_API void lua_setglobal (lua_State *L, const char *name) { |
no test coverage detected