diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2017-11-08 12:50:23 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2017-11-08 12:50:23 -0200 |
commit | 26679ea35bf261f2b5edc2fb2f5cc4df483fd50d (patch) | |
tree | 94c99ed74251cdf3e10a7e52560c3a7a78053ad1 /ltm.c | |
parent | c3e5946fb2b7b5781d9bca9d303967abe6263482 (diff) | |
download | lua-26679ea35bf261f2b5edc2fb2f5cc4df483fd50d.tar.gz lua-26679ea35bf261f2b5edc2fb2f5cc4df483fd50d.tar.bz2 lua-26679ea35bf261f2b5edc2fb2f5cc4df483fd50d.zip |
new function 'luaV_flttointeger' to convert floats to integers (without
string coercions) + string operands to bitwise operations handled
by string metamethods
Diffstat (limited to 'ltm.c')
-rw-r--r-- | ltm.c | 5 |
1 files changed, 2 insertions, 3 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ltm.c,v 2.45 2017/10/04 15:49:05 roberto Exp $ | 2 | ** $Id: ltm.c,v 2.47 2017/11/07 13:25:26 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 | */ |
@@ -153,8 +153,7 @@ void luaT_trybinTM (lua_State *L, const TValue *p1, const TValue *p2, | |||
153 | /* call never returns, but to avoid warnings: *//* FALLTHROUGH */ | 153 | /* call never returns, but to avoid warnings: *//* FALLTHROUGH */ |
154 | case TM_BAND: case TM_BOR: case TM_BXOR: | 154 | case TM_BAND: case TM_BOR: case TM_BXOR: |
155 | case TM_SHL: case TM_SHR: case TM_BNOT: { | 155 | case TM_SHL: case TM_SHR: case TM_BNOT: { |
156 | lua_Number dummy; | 156 | if (ttisnumber(p1) && ttisnumber(p2)) |
157 | if (tonumber(p1, &dummy) && tonumber(p2, &dummy)) | ||
158 | luaG_tointerror(L, p1, p2); | 157 | luaG_tointerror(L, p1, p2); |
159 | else | 158 | else |
160 | luaG_opinterror(L, p1, p2, "perform bitwise operation on"); | 159 | luaG_opinterror(L, p1, p2, "perform bitwise operation on"); |