coercion string->number in arithmetic operations moved to string

library
This commit is contained in:
Roberto Ierusalimschy
2017-07-07 13:34:32 -03:00
parent 07db10813c
commit 4dff277255
5 changed files with 111 additions and 19 deletions

View File

@@ -1,5 +1,5 @@
/*
** $Id: ldebug.c,v 2.127 2017/06/27 11:35:31 roberto Exp roberto $
** $Id: ldebug.c,v 2.128 2017/06/29 15:06:44 roberto Exp roberto $
** Debug Interface
** See Copyright Notice in lua.h
*/
@@ -679,8 +679,7 @@ l_noret luaG_concaterror (lua_State *L, const TValue *p1, const TValue *p2) {
l_noret luaG_opinterror (lua_State *L, const TValue *p1,
const TValue *p2, const char *msg) {
lua_Number temp;
if (!tonumber(p1, &temp)) /* first operand is wrong? */
if (!ttisnumber(p1)) /* first operand is wrong? */
p2 = p1; /* now second is wrong */
luaG_typeerror(L, p2, msg);
}