aboutsummaryrefslogtreecommitdiff
path: root/ltable.h
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2023-05-16 14:55:49 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2023-05-16 14:55:49 -0300
commitf8d30826dda6ee8e99200de57a1997734b853db2 (patch)
treed3a24665802f41fe3216714252ed189006f302cd /ltable.h
parent351ccd733298e08c41937c1baf22a68e62bfeca9 (diff)
downloadlua-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.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/ltable.h b/ltable.h
index c8a8c5e7..b9bb416a 100644
--- a/ltable.h
+++ b/ltable.h
@@ -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
54LUAI_FUNC int luaH_getshortstr1 (Table *t, TString *key, TValue *res); 58LUAI_FUNC int luaH_getshortstr1 (Table *t, TString *key, TValue *res);
55LUAI_FUNC int luaH_getstr1 (Table *t, TString *key, TValue *res); 59LUAI_FUNC int luaH_getstr1 (Table *t, TString *key, TValue *res);
56LUAI_FUNC int luaH_get1 (Table *t, const TValue *key, TValue *res); 60LUAI_FUNC int luaH_get1 (Table *t, const TValue *key, TValue *res);
57LUAI_FUNC int luaH_getint1 (Table *t, lua_Integer key, TValue *res); 61LUAI_FUNC int luaH_getint1 (Table *t, lua_Integer key, TValue *res);
58 62
63LUAI_FUNC int luaH_setint1 (Table *t, lua_Integer key, TValue *val);
64LUAI_FUNC int luaH_setshortstr1 (Table *t, TString *key, TValue *val);
65LUAI_FUNC int luaH_setstr1 (Table *t, TString *key, TValue *val);
66LUAI_FUNC int luaH_set1 (Table *t, const TValue *key, TValue *val);
67
59LUAI_FUNC const TValue *luaH_getint (Table *t, lua_Integer key); 68LUAI_FUNC const TValue *luaH_getint (Table *t, lua_Integer key);
60LUAI_FUNC void luaH_setint (lua_State *L, Table *t, lua_Integer key, 69LUAI_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);
69LUAI_FUNC void luaH_finishset (lua_State *L, Table *t, const TValue *key, 78LUAI_FUNC void luaH_finishset (lua_State *L, Table *t, const TValue *key,
70 const TValue *slot, TValue *value); 79 const TValue *slot, TValue *value);
80LUAI_FUNC void luaH_finishset1 (lua_State *L, Table *t, const TValue *key,
81 TValue *value, int aux);
71LUAI_FUNC Table *luaH_new (lua_State *L); 82LUAI_FUNC Table *luaH_new (lua_State *L);
72LUAI_FUNC void luaH_resize (lua_State *L, Table *t, unsigned int nasize, 83LUAI_FUNC void luaH_resize (lua_State *L, Table *t, unsigned int nasize,
73 unsigned int nhsize); 84 unsigned int nhsize);