From 1b100335839e13021b4731f0407b87e4f7544dc0 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Wed, 27 Sep 2017 15:59:08 -0300 Subject: new function 'luaT_trybiniTM' to handle tag methods for instructions with immediate integer arguments --- ltm.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'ltm.c') diff --git a/ltm.c b/ltm.c index cbc4cc5e..2de75a31 100644 --- a/ltm.c +++ b/ltm.c @@ -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)) -- cgit v1.2.3-55-g6feb