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