new function 'luaT_trybiniTM'

to handle tag methods for instructions with immediate integer arguments
This commit is contained in:
Roberto Ierusalimschy
2017-09-27 15:59:08 -03:00
parent 00e728af88
commit 1b10033583
3 changed files with 19 additions and 12 deletions

14
ltm.c
View File

@@ -1,5 +1,5 @@
/*
** $Id: ltm.c,v 2.42 2017/06/29 15:06:44 roberto Exp roberto $
** $Id: ltm.c,v 2.43 2017/07/27 13:50:16 roberto Exp roberto $
** Tag methods
** See Copyright Notice in lua.h
*/
@@ -167,6 +167,18 @@ void luaT_trybinTM (lua_State *L, const TValue *p1, const TValue *p2,
}
void luaT_trybiniTM (lua_State *L, const TValue *p1, int i2,
int inv, StkId res, TMS event) {
TValue aux; TValue *p2;
setivalue(&aux, i2);
if (inv) { /* arguments were exchanged? */
p2 = p1; p1 = &aux; /* correct them */
}
else p2 = &aux;
luaT_trybinTM(L, p1, p2, res, event);
}
int luaT_callorderTM (lua_State *L, const TValue *p1, const TValue *p2,
TMS event) {
if (!callbinTM(L, p1, p2, L->top, event))