aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2014-11-10 12:46:05 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2014-11-10 12:46:05 -0200
commitad20689febfe15e20c9bce6bb74459f169499524 (patch)
tree35ea80b8a81e86e375b8cc57444919dbcc7f8137
parente32079015495f01e470b285a9a1f09552ab5c615 (diff)
downloadlua-ad20689febfe15e20c9bce6bb74459f169499524.tar.gz
lua-ad20689febfe15e20c9bce6bb74459f169499524.tar.bz2
lua-ad20689febfe15e20c9bce6bb74459f169499524.zip
better error message for bitwise operators (they are not arithmetic...)
-rw-r--r--ldebug.h7
-rw-r--r--ltm.c6
2 files changed, 8 insertions, 5 deletions
diff --git a/ldebug.h b/ldebug.h
index 6e1dfd28..7fba153c 100644
--- a/ldebug.h
+++ b/ldebug.h
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ldebug.h,v 2.10 2013/05/06 17:19:11 roberto Exp roberto $ 2** $Id: ldebug.h,v 2.11 2014/02/25 14:31:16 roberto Exp roberto $
3** Auxiliary functions from Debug Interface module 3** Auxiliary functions from Debug Interface module
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -25,8 +25,9 @@ LUAI_FUNC l_noret luaG_typeerror (lua_State *L, const TValue *o,
25 const char *opname); 25 const char *opname);
26LUAI_FUNC l_noret luaG_concaterror (lua_State *L, const TValue *p1, 26LUAI_FUNC l_noret luaG_concaterror (lua_State *L, const TValue *p1,
27 const TValue *p2); 27 const TValue *p2);
28LUAI_FUNC l_noret luaG_aritherror (lua_State *L, const TValue *p1, 28LUAI_FUNC l_noret luaG_opinterror (lua_State *L, const TValue *p1,
29 const TValue *p2); 29 const TValue *p2,
30 const char *msg);
30LUAI_FUNC l_noret luaG_tointerror (lua_State *L, const TValue *p1, 31LUAI_FUNC l_noret luaG_tointerror (lua_State *L, const TValue *p1,
31 const TValue *p2); 32 const TValue *p2);
32LUAI_FUNC l_noret luaG_ordererror (lua_State *L, const TValue *p1, 33LUAI_FUNC l_noret luaG_ordererror (lua_State *L, const TValue *p1,
diff --git a/ltm.c b/ltm.c
index 94c077d5..f4625627 100644
--- a/ltm.c
+++ b/ltm.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ltm.c,v 2.29 2014/07/18 13:36:14 roberto Exp roberto $ 2** $Id: ltm.c,v 2.30 2014/11/02 19:19:04 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*/
@@ -122,10 +122,12 @@ void luaT_trybinTM (lua_State *L, const TValue *p1, const TValue *p2,
122 lua_Number dummy; 122 lua_Number dummy;
123 if (tonumber(p1, &dummy) && tonumber(p2, &dummy)) 123 if (tonumber(p1, &dummy) && tonumber(p2, &dummy))
124 luaG_tointerror(L, p1, p2); 124 luaG_tointerror(L, p1, p2);
125 else if (event != TM_IDIV)
126 luaG_opinterror(L, p1, p2, "perform bitwise operation on");
125 /* else go through */ 127 /* else go through */
126 } 128 }
127 default: 129 default:
128 luaG_aritherror(L, p1, p2); 130 luaG_opinterror(L, p1, p2, "perform arithmetic on");
129 } 131 }
130 } 132 }
131} 133}