aboutsummaryrefslogtreecommitdiff
path: root/ltm.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2013-04-29 13:56:50 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2013-04-29 13:56:50 -0300
commitb4be5075784bcc8fed974bda4005425a9ccec1ba (patch)
tree4b1ac6f23e4a46310f1ed6707c2f733edff6239c /ltm.c
parent360587f31959b9a112b13000b3c7ee8ae51cf146 (diff)
downloadlua-b4be5075784bcc8fed974bda4005425a9ccec1ba.tar.gz
lua-b4be5075784bcc8fed974bda4005425a9ccec1ba.tar.bz2
lua-b4be5075784bcc8fed974bda4005425a9ccec1ba.zip
new function 'luaT_trybinTM'
Diffstat (limited to 'ltm.c')
-rw-r--r--ltm.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/ltm.c b/ltm.c
index a016cc42..43bcfb57 100644
--- a/ltm.c
+++ b/ltm.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ltm.c,v 2.17 2013/04/25 16:07:52 roberto Exp roberto $ 2** $Id: ltm.c,v 2.18 2013/04/26 13:07:53 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*/
@@ -12,6 +12,7 @@
12 12
13#include "lua.h" 13#include "lua.h"
14 14
15#include "ldebug.h"
15#include "ldo.h" 16#include "ldo.h"
16#include "lobject.h" 17#include "lobject.h"
17#include "lstate.h" 18#include "lstate.h"
@@ -106,6 +107,17 @@ int luaT_callbinTM (lua_State *L, const TValue *p1, const TValue *p2,
106} 107}
107 108
108 109
110void luaT_trybinTM (lua_State *L, const TValue *p1, const TValue *p2,
111 StkId res, TMS event) {
112 if (!luaT_callbinTM(L, p1, p2, res, event)) {
113 if (event == TM_CONCAT)
114 luaG_concaterror(L, p1, p2);
115 else
116 luaG_aritherror(L, p1, p2);
117 }
118}
119
120
109const TValue *luaT_getequalTM (lua_State *L, Table *mt1, Table *mt2) { 121const TValue *luaT_getequalTM (lua_State *L, Table *mt1, Table *mt2) {
110 const TValue *tm1 = fasttm(L, mt1, TM_EQ); 122 const TValue *tm1 = fasttm(L, mt1, TM_EQ);
111 const TValue *tm2; 123 const TValue *tm2;