diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2024-03-18 15:56:32 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2024-03-18 15:56:32 -0300 |
commit | ce6f5502c99ce9a367e25b678e375db6f8164d73 (patch) | |
tree | 47f36dc2f6da96dfda325d7b587f3a20599e9317 /lvm.h | |
parent | ba710603811c68fe3a69b3bb98e9038d37489a79 (diff) | |
download | lua-ce6f5502c99ce9a367e25b678e375db6f8164d73.tar.gz lua-ce6f5502c99ce9a367e25b678e375db6f8164d73.tar.bz2 lua-ce6f5502c99ce9a367e25b678e375db6f8164d73.zip |
'luaH_get' functions return 'TValue'
Instead of receiving a parameter telling them where to put the result
of the query, these functions return the TValue directly. (That is,
they return a structure.)
Diffstat (limited to 'lvm.h')
-rw-r--r-- | lvm.h | 18 |
1 files changed, 11 insertions, 7 deletions
@@ -78,17 +78,19 @@ typedef enum { | |||
78 | /* | 78 | /* |
79 | ** fast track for 'gettable' | 79 | ** fast track for 'gettable' |
80 | */ | 80 | */ |
81 | #define luaV_fastget(t,k,res,f, hres) \ | 81 | #define luaV_fastget(t,k,res,f, aux) \ |
82 | (hres = (!ttistable(t) ? HNOTATABLE : f(hvalue(t), k, res))) | 82 | {if (!ttistable(t)) setnotableV(aux); \ |
83 | else { aux = f(hvalue(t), k); \ | ||
84 | if (!isemptyV(aux)) { setobjV(cast(lua_State*, NULL), res, aux); } } } | ||
83 | 85 | ||
84 | 86 | ||
85 | /* | 87 | /* |
86 | ** Special case of 'luaV_fastget' for integers, inlining the fast case | 88 | ** Special case of 'luaV_fastget' for integers, inlining the fast case |
87 | ** of 'luaH_getint'. | 89 | ** of 'luaH_getint'. |
88 | */ | 90 | */ |
89 | #define luaV_fastgeti(t,k,res,hres) \ | 91 | #define luaV_fastgeti(t,k,res,aux) \ |
90 | if (!ttistable(t)) hres = HNOTATABLE; \ | 92 | { if (!ttistable(t)) setnotableV(aux); \ |
91 | else { luaH_fastgeti(hvalue(t), k, res, hres); } | 93 | else { luaH_fastgeti(hvalue(t), k, res, aux); } } |
92 | 94 | ||
93 | 95 | ||
94 | #define luaV_fastset(t,k,val,hres,f) \ | 96 | #define luaV_fastset(t,k,val,hres,f) \ |
@@ -120,8 +122,10 @@ LUAI_FUNC int luaV_tointeger (const TValue *obj, lua_Integer *p, F2Imod mode); | |||
120 | LUAI_FUNC int luaV_tointegerns (const TValue *obj, lua_Integer *p, | 122 | LUAI_FUNC int luaV_tointegerns (const TValue *obj, lua_Integer *p, |
121 | F2Imod mode); | 123 | F2Imod mode); |
122 | LUAI_FUNC int luaV_flttointeger (lua_Number n, lua_Integer *p, F2Imod mode); | 124 | LUAI_FUNC int luaV_flttointeger (lua_Number n, lua_Integer *p, F2Imod mode); |
123 | LUAI_FUNC void luaV_finishget (lua_State *L, const TValue *t, TValue *key, | 125 | #define luaV_finishget(L,t,key,val,aux) \ |
124 | StkId val, int aux); | 126 | luaV_finishget_(L,t,key,val,ttypetagV(aux)) |
127 | LUAI_FUNC void luaV_finishget_ (lua_State *L, const TValue *t, TValue *key, | ||
128 | StkId val, int tag); | ||
125 | LUAI_FUNC void luaV_finishset (lua_State *L, const TValue *t, TValue *key, | 129 | LUAI_FUNC void luaV_finishset (lua_State *L, const TValue *t, TValue *key, |
126 | TValue *val, int aux); | 130 | TValue *val, int aux); |
127 | LUAI_FUNC void luaV_finishOp (lua_State *L); | 131 | LUAI_FUNC void luaV_finishOp (lua_State *L); |