aboutsummaryrefslogtreecommitdiff
path: root/ltm.c
diff options
context:
space:
mode:
Diffstat (limited to 'ltm.c')
-rw-r--r--ltm.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/ltm.c b/ltm.c
index 6ca7e9d3..1aa25bf0 100644
--- a/ltm.c
+++ b/ltm.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ltm.c,v 2.23 2013/12/16 19:06:52 roberto Exp roberto $ 2** $Id: ltm.c,v 2.24 2013/12/18 14:12:03 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*/
@@ -38,8 +38,8 @@ void luaT_init (lua_State *L) {
38 "__gc", "__mode", "__len", "__eq", 38 "__gc", "__mode", "__len", "__eq",
39 "__add", "__sub", "__mul", "__mod", "__pow", 39 "__add", "__sub", "__mul", "__mod", "__pow",
40 "__div", "__idiv", 40 "__div", "__idiv",
41 "__band", "__bor", "__bxor", 41 "__band", "__bor", "__bxor", "__shl", "__shr",
42 "__unm", "__lt", "__le", 42 "__unm", "__bnot", "__lt", "__le",
43 "__concat", "__call" 43 "__concat", "__call"
44 }; 44 };
45 int i; 45 int i;
@@ -112,12 +112,17 @@ int luaT_callbinTM (lua_State *L, const TValue *p1, const TValue *p2,
112void luaT_trybinTM (lua_State *L, const TValue *p1, const TValue *p2, 112void luaT_trybinTM (lua_State *L, const TValue *p1, const TValue *p2,
113 StkId res, TMS event) { 113 StkId res, TMS event) {
114 if (!luaT_callbinTM(L, p1, p2, res, event)) { 114 if (!luaT_callbinTM(L, p1, p2, res, event)) {
115 if (event == TM_CONCAT) 115 switch (event) {
116 luaG_concaterror(L, p1, p2); 116 case TM_CONCAT:
117 else if (event == TM_IDIV && ttisnumber(p1) && ttisnumber(p2)) 117 luaG_concaterror(L, p1, p2);
118 luaG_tointerror(L, p1, p2); 118 case TM_IDIV: case TM_BAND: case TM_BOR: case TM_BXOR:
119 else 119 case TM_SHL: case TM_SHR: case TM_BNOT:
120 luaG_aritherror(L, p1, p2); 120 if (ttisnumber(p1) && ttisnumber(p2))
121 luaG_tointerror(L, p1, p2);
122 /* else go through */
123 default:
124 luaG_aritherror(L, p1, p2);
125 }
121 } 126 }
122} 127}
123 128