diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2020-12-04 11:08:42 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2020-12-04 11:08:42 -0300 |
| commit | 23051e830a8b212f831443eb888e93e30fa8bb19 (patch) | |
| tree | 782f56415ad3a8799c4dea8d6d329f1550d3d7c3 /lapi.c | |
| parent | f15589f3b0da477e5dda8863cbf4c0b36469e36d (diff) | |
| download | lua-23051e830a8b212f831443eb888e93e30fa8bb19.tar.gz lua-23051e830a8b212f831443eb888e93e30fa8bb19.tar.bz2 lua-23051e830a8b212f831443eb888e93e30fa8bb19.zip | |
Changes in the API of 'luaH_set' and related functions
Functions to set values in a table (luaH_set, luaH_newkey, etc.) receive
the new value, instead of returning a slot where to put the value.
Diffstat (limited to 'lapi.c')
| -rw-r--r-- | lapi.c | 4 |
1 files changed, 1 insertions, 3 deletions
| @@ -871,12 +871,10 @@ LUA_API void lua_seti (lua_State *L, int idx, lua_Integer n) { | |||
| 871 | 871 | ||
| 872 | static void aux_rawset (lua_State *L, int idx, TValue *key, int n) { | 872 | static void aux_rawset (lua_State *L, int idx, TValue *key, int n) { |
| 873 | Table *t; | 873 | Table *t; |
| 874 | TValue *slot; | ||
| 875 | lua_lock(L); | 874 | lua_lock(L); |
| 876 | api_checknelems(L, n); | 875 | api_checknelems(L, n); |
| 877 | t = gettable(L, idx); | 876 | t = gettable(L, idx); |
| 878 | slot = luaH_set(L, t, key); | 877 | luaH_set(L, t, key, s2v(L->top - 1)); |
| 879 | setobj2t(L, slot, s2v(L->top - 1)); | ||
| 880 | invalidateTMcache(t); | 878 | invalidateTMcache(t); |
| 881 | luaC_barrierback(L, obj2gco(t), s2v(L->top - 1)); | 879 | luaC_barrierback(L, obj2gco(t), s2v(L->top - 1)); |
| 882 | L->top -= n; | 880 | L->top -= n; |
