diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2023-05-16 14:55:49 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2023-05-16 14:55:49 -0300 |
commit | f8d30826dda6ee8e99200de57a1997734b853db2 (patch) | |
tree | d3a24665802f41fe3216714252ed189006f302cd /ltable.h | |
parent | 351ccd733298e08c41937c1baf22a68e62bfeca9 (diff) | |
download | lua-f8d30826dda6ee8e99200de57a1997734b853db2.tar.gz lua-f8d30826dda6ee8e99200de57a1997734b853db2.tar.bz2 lua-f8d30826dda6ee8e99200de57a1997734b853db2.zip |
New table API for 'set' functions
Diffstat (limited to 'ltable.h')
-rw-r--r-- | ltable.h | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -39,6 +39,7 @@ | |||
39 | #define HOK 0 | 39 | #define HOK 0 |
40 | #define HNOTFOUND 1 | 40 | #define HNOTFOUND 1 |
41 | #define HNOTATABLE 2 | 41 | #define HNOTATABLE 2 |
42 | #define HFIRSTNODE 3 | ||
42 | 43 | ||
43 | 44 | ||
44 | /* fast access to components of array values */ | 45 | /* fast access to components of array values */ |
@@ -50,12 +51,20 @@ | |||
50 | #define arr2val(h,k,tag,res) \ | 51 | #define arr2val(h,k,tag,res) \ |
51 | ((res)->tt_ = tag, (res)->value_ = *getArrVal(h,k)) | 52 | ((res)->tt_ = tag, (res)->value_ = *getArrVal(h,k)) |
52 | 53 | ||
54 | #define val2arr(h,k,tag,val) \ | ||
55 | (*tag = (val)->tt_, *getArrVal(h,k) = (val)->value_) | ||
56 | |||
53 | 57 | ||
54 | LUAI_FUNC int luaH_getshortstr1 (Table *t, TString *key, TValue *res); | 58 | LUAI_FUNC int luaH_getshortstr1 (Table *t, TString *key, TValue *res); |
55 | LUAI_FUNC int luaH_getstr1 (Table *t, TString *key, TValue *res); | 59 | LUAI_FUNC int luaH_getstr1 (Table *t, TString *key, TValue *res); |
56 | LUAI_FUNC int luaH_get1 (Table *t, const TValue *key, TValue *res); | 60 | LUAI_FUNC int luaH_get1 (Table *t, const TValue *key, TValue *res); |
57 | LUAI_FUNC int luaH_getint1 (Table *t, lua_Integer key, TValue *res); | 61 | LUAI_FUNC int luaH_getint1 (Table *t, lua_Integer key, TValue *res); |
58 | 62 | ||
63 | LUAI_FUNC int luaH_setint1 (Table *t, lua_Integer key, TValue *val); | ||
64 | LUAI_FUNC int luaH_setshortstr1 (Table *t, TString *key, TValue *val); | ||
65 | LUAI_FUNC int luaH_setstr1 (Table *t, TString *key, TValue *val); | ||
66 | LUAI_FUNC int luaH_set1 (Table *t, const TValue *key, TValue *val); | ||
67 | |||
59 | LUAI_FUNC const TValue *luaH_getint (Table *t, lua_Integer key); | 68 | LUAI_FUNC const TValue *luaH_getint (Table *t, lua_Integer key); |
60 | LUAI_FUNC void luaH_setint (lua_State *L, Table *t, lua_Integer key, | 69 | LUAI_FUNC void luaH_setint (lua_State *L, Table *t, lua_Integer key, |
61 | TValue *value); | 70 | TValue *value); |
@@ -68,6 +77,8 @@ LUAI_FUNC void luaH_set (lua_State *L, Table *t, const TValue *key, | |||
68 | TValue *value); | 77 | TValue *value); |
69 | LUAI_FUNC void luaH_finishset (lua_State *L, Table *t, const TValue *key, | 78 | LUAI_FUNC void luaH_finishset (lua_State *L, Table *t, const TValue *key, |
70 | const TValue *slot, TValue *value); | 79 | const TValue *slot, TValue *value); |
80 | LUAI_FUNC void luaH_finishset1 (lua_State *L, Table *t, const TValue *key, | ||
81 | TValue *value, int aux); | ||
71 | LUAI_FUNC Table *luaH_new (lua_State *L); | 82 | LUAI_FUNC Table *luaH_new (lua_State *L); |
72 | LUAI_FUNC void luaH_resize (lua_State *L, Table *t, unsigned int nasize, | 83 | LUAI_FUNC void luaH_resize (lua_State *L, Table *t, unsigned int nasize, |
73 | unsigned int nhsize); | 84 | unsigned int nhsize); |