aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ltm.c14
-rw-r--r--ltm.h4
2 files changed, 16 insertions, 2 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;
diff --git a/ltm.h b/ltm.h
index 8f088528..053dc145 100644
--- a/ltm.h
+++ b/ltm.h
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ltm.h,v 2.14 2013/04/25 16:07:52 roberto Exp roberto $ 2** $Id: ltm.h,v 2.15 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*/
@@ -59,6 +59,8 @@ LUAI_FUNC void luaT_callTM (lua_State *L, const TValue *f, const TValue *p1,
59 const TValue *p2, TValue *p3, int hasres); 59 const TValue *p2, TValue *p3, int hasres);
60LUAI_FUNC int luaT_callbinTM (lua_State *L, const TValue *p1, const TValue *p2, 60LUAI_FUNC int luaT_callbinTM (lua_State *L, const TValue *p1, const TValue *p2,
61 StkId res, TMS event); 61 StkId res, TMS event);
62LUAI_FUNC void luaT_trybinTM (lua_State *L, const TValue *p1, const TValue *p2,
63 StkId res, TMS event);
62LUAI_FUNC const TValue *luaT_getequalTM (lua_State *L, Table *mt1, Table *mt2); 64LUAI_FUNC const TValue *luaT_getequalTM (lua_State *L, Table *mt1, Table *mt2);
63LUAI_FUNC int luaT_callorderTM (lua_State *L, const TValue *p1, 65LUAI_FUNC int luaT_callorderTM (lua_State *L, const TValue *p1,
64 const TValue *p2, TMS event); 66 const TValue *p2, TMS event);