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