diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2017-09-27 15:59:08 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2017-09-27 15:59:08 -0300 |
commit | 1b100335839e13021b4731f0407b87e4f7544dc0 (patch) | |
tree | 085979000de158de7d034c34d208b1318bbea90f /ltm.c | |
parent | 00e728af885d2781e365071557530a6685110d7e (diff) | |
download | lua-1b100335839e13021b4731f0407b87e4f7544dc0.tar.gz lua-1b100335839e13021b4731f0407b87e4f7544dc0.tar.bz2 lua-1b100335839e13021b4731f0407b87e4f7544dc0.zip |
new function 'luaT_trybiniTM'
to handle tag methods for instructions with immediate integer arguments
Diffstat (limited to 'ltm.c')
-rw-r--r-- | ltm.c | 14 |
1 files changed, 13 insertions, 1 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ltm.c,v 2.42 2017/06/29 15:06:44 roberto Exp roberto $ | 2 | ** $Id: ltm.c,v 2.43 2017/07/27 13:50:16 roberto Exp roberto $ |
3 | ** Tag methods | 3 | ** Tag methods |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -167,6 +167,18 @@ void luaT_trybinTM (lua_State *L, const TValue *p1, const TValue *p2, | |||
167 | } | 167 | } |
168 | 168 | ||
169 | 169 | ||
170 | void luaT_trybiniTM (lua_State *L, const TValue *p1, int i2, | ||
171 | int inv, StkId res, TMS event) { | ||
172 | TValue aux; TValue *p2; | ||
173 | setivalue(&aux, i2); | ||
174 | if (inv) { /* arguments were exchanged? */ | ||
175 | p2 = p1; p1 = &aux; /* correct them */ | ||
176 | } | ||
177 | else p2 = &aux; | ||
178 | luaT_trybinTM(L, p1, p2, res, event); | ||
179 | } | ||
180 | |||
181 | |||
170 | int luaT_callorderTM (lua_State *L, const TValue *p1, const TValue *p2, | 182 | int luaT_callorderTM (lua_State *L, const TValue *p1, const TValue *p2, |
171 | TMS event) { | 183 | TMS event) { |
172 | if (!callbinTM(L, p1, p2, L->top, event)) | 184 | if (!callbinTM(L, p1, p2, L->top, event)) |