diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2018-02-23 10:16:18 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2018-02-23 10:16:18 -0300 |
commit | 9243c414d92c253edd908f438caa31e2aa16f3f4 (patch) | |
tree | e8959a48f4672037aef061cc6eb82bba21d0766b /ltable.h | |
parent | 477ca2fe8ceaf79038972977915987adbef0e425 (diff) | |
download | lua-9243c414d92c253edd908f438caa31e2aa16f3f4.tar.gz lua-9243c414d92c253edd908f438caa31e2aa16f3f4.tar.bz2 lua-9243c414d92c253edd908f438caa31e2aa16f3f4.zip |
first version of empty entries in tables
(so that, in the future, tables can contain regular nil entries)
Diffstat (limited to 'ltable.h')
-rw-r--r-- | ltable.h | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ltable.h,v 2.24 2017/05/19 12:48:15 roberto Exp roberto $ | 2 | ** $Id: ltable.h,v 2.25 2017/06/09 16:48:44 roberto Exp roberto $ |
3 | ** Lua tables (hash) | 3 | ** Lua tables (hash) |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -21,6 +21,8 @@ | |||
21 | /* true when 't' is using 'dummynode' as its hash part */ | 21 | /* true when 't' is using 'dummynode' as its hash part */ |
22 | #define isdummy(t) ((t)->lastfree == NULL) | 22 | #define isdummy(t) ((t)->lastfree == NULL) |
23 | 23 | ||
24 | #define luaH_emptyobject (&luaH_emptyobject_) | ||
25 | |||
24 | 26 | ||
25 | /* allocated size for hash nodes */ | 27 | /* allocated size for hash nodes */ |
26 | #define allocsizenode(t) (isdummy(t) ? 0 : sizenode(t)) | 28 | #define allocsizenode(t) (isdummy(t) ? 0 : sizenode(t)) |
@@ -30,6 +32,9 @@ | |||
30 | #define nodefromval(v) cast(Node *, (v)) | 32 | #define nodefromval(v) cast(Node *, (v)) |
31 | 33 | ||
32 | 34 | ||
35 | LUAI_DDEC const TValue luaH_emptyobject_; | ||
36 | |||
37 | |||
33 | LUAI_FUNC const TValue *luaH_getint (Table *t, lua_Integer key); | 38 | LUAI_FUNC const TValue *luaH_getint (Table *t, lua_Integer key); |
34 | LUAI_FUNC void luaH_setint (lua_State *L, Table *t, lua_Integer key, | 39 | LUAI_FUNC void luaH_setint (lua_State *L, Table *t, lua_Integer key, |
35 | TValue *value); | 40 | TValue *value); |