diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2023-11-08 10:41:24 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2023-11-08 10:41:24 -0300 |
| commit | b8a9d14032b717f6e5c493a9ec20e3494c9f82a0 (patch) | |
| tree | 940166a4aae63a41616e86e02042770056a15d81 | |
| parent | 19afd916870a0621b59e8728d439b0fe10288b99 (diff) | |
| download | lua-b8a9d14032b717f6e5c493a9ec20e3494c9f82a0.tar.gz lua-b8a9d14032b717f6e5c493a9ec20e3494c9f82a0.tar.bz2 lua-b8a9d14032b717f6e5c493a9ec20e3494c9f82a0.zip | |
Details
Comments and parameter name in header file.
| -rw-r--r-- | ltable.h | 27 |
1 files changed, 18 insertions, 9 deletions
| @@ -52,12 +52,18 @@ | |||
| 52 | #define HFIRSTNODE 3 | 52 | #define HFIRSTNODE 3 |
| 53 | 53 | ||
| 54 | /* | 54 | /* |
| 55 | ** Besides these values, pset (pre-set) operations may also return an | 55 | ** 'luaH_get*' operations set 'res' and return HOK, unless the value is |
| 56 | ** encoding of where the value should go (usually called 'hres'). That | 56 | ** absent. In that case, they set nothing and return HNOTFOUND. |
| 57 | ** means that there is a slot with that key but with no value. (pset | 57 | ** The 'luaH_pset*' (pre-set) operations set the given value and return |
| 58 | ** cannot set that value because there might be a metamethod.) If the | 58 | ** HOK, unless the original value is absent. In that case, if the key |
| 59 | ** slot is in the hash part, the encoding is (HFIRSTNODE + hash index); | 59 | ** is really absent, they return HNOTFOUND. Otherwise, if there is a |
| 60 | ** if the slot is in the array part, the encoding is (~array index). | 60 | ** slot with that key but with no value, 'luaH_pset*' return an encoding |
| 61 | ** of where the key is (usually called 'hres'). (pset cannot set that | ||
| 62 | ** value because there might be a metamethod.) If the slot is in the | ||
| 63 | ** hash part, the encoding is (HFIRSTNODE + hash index); if the slot is | ||
| 64 | ** in the array part, the encoding is (~array index), a negative value. | ||
| 65 | ** The value HNOTATABLE is used by the fast macros to signal that the | ||
| 66 | ** value being indexed is not a table. | ||
| 61 | */ | 67 | */ |
| 62 | 68 | ||
| 63 | 69 | ||
| @@ -125,11 +131,14 @@ union ArrayCell { | |||
| 125 | (*tag = (val)->tt_, *getArrVal(h,(k)-1u) = (val)->value_) | 131 | (*tag = (val)->tt_, *getArrVal(h,(k)-1u) = (val)->value_) |
| 126 | 132 | ||
| 127 | 133 | ||
| 134 | LUAI_FUNC int luaH_get (Table *t, const TValue *key, TValue *res); | ||
| 128 | LUAI_FUNC int luaH_getshortstr (Table *t, TString *key, TValue *res); | 135 | LUAI_FUNC int luaH_getshortstr (Table *t, TString *key, TValue *res); |
| 129 | LUAI_FUNC int luaH_getstr (Table *t, TString *key, TValue *res); | 136 | LUAI_FUNC int luaH_getstr (Table *t, TString *key, TValue *res); |
| 130 | LUAI_FUNC int luaH_get (Table *t, const TValue *key, TValue *res); | ||
| 131 | LUAI_FUNC int luaH_getint (Table *t, lua_Integer key, TValue *res); | 137 | LUAI_FUNC int luaH_getint (Table *t, lua_Integer key, TValue *res); |
| 132 | 138 | ||
| 139 | /* Special get for metamethods */ | ||
| 140 | LUAI_FUNC const TValue *luaH_Hgetshortstr (Table *t, TString *key); | ||
| 141 | |||
| 133 | LUAI_FUNC TString *luaH_getstrkey (Table *t, TString *key); | 142 | LUAI_FUNC TString *luaH_getstrkey (Table *t, TString *key); |
| 134 | 143 | ||
| 135 | LUAI_FUNC int luaH_psetint (Table *t, lua_Integer key, TValue *val); | 144 | LUAI_FUNC int luaH_psetint (Table *t, lua_Integer key, TValue *val); |
| @@ -139,11 +148,11 @@ LUAI_FUNC int luaH_pset (Table *t, const TValue *key, TValue *val); | |||
| 139 | 148 | ||
| 140 | LUAI_FUNC void luaH_setint (lua_State *L, Table *t, lua_Integer key, | 149 | LUAI_FUNC void luaH_setint (lua_State *L, Table *t, lua_Integer key, |
| 141 | TValue *value); | 150 | TValue *value); |
| 142 | LUAI_FUNC const TValue *luaH_Hgetshortstr (Table *t, TString *key); | ||
| 143 | LUAI_FUNC void luaH_set (lua_State *L, Table *t, const TValue *key, | 151 | LUAI_FUNC void luaH_set (lua_State *L, Table *t, const TValue *key, |
| 144 | TValue *value); | 152 | TValue *value); |
| 153 | |||
| 145 | LUAI_FUNC void luaH_finishset (lua_State *L, Table *t, const TValue *key, | 154 | LUAI_FUNC void luaH_finishset (lua_State *L, Table *t, const TValue *key, |
| 146 | TValue *value, int aux); | 155 | TValue *value, int hres); |
| 147 | LUAI_FUNC Table *luaH_new (lua_State *L); | 156 | LUAI_FUNC Table *luaH_new (lua_State *L); |
| 148 | LUAI_FUNC void luaH_resize (lua_State *L, Table *t, unsigned int nasize, | 157 | LUAI_FUNC void luaH_resize (lua_State *L, Table *t, unsigned int nasize, |
| 149 | unsigned int nhsize); | 158 | unsigned int nhsize); |
