diff options
| -rw-r--r-- | lapi.c | 8 |
1 files changed, 6 insertions, 2 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lapi.c,v 2.80 2009/06/17 17:52:57 roberto Exp roberto $ | 2 | ** $Id: lapi.c,v 2.81 2009/06/17 18:38:54 roberto Exp roberto $ |
| 3 | ** Lua API | 3 | ** Lua API |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -278,7 +278,11 @@ LUA_API int lua_rawequal (lua_State *L, int index1, int index2) { | |||
| 278 | LUA_API void lua_arith (lua_State *L, int op) { | 278 | LUA_API void lua_arith (lua_State *L, int op) { |
| 279 | lua_lock(L); | 279 | lua_lock(L); |
| 280 | api_checknelems(L, 2); | 280 | api_checknelems(L, 2); |
| 281 | luaV_arith(L, L->top - 2, L->top - 2, L->top - 1, op - LUA_OPADD + TM_ADD); | 281 | if (ttisnumber(L->top - 2) && ttisnumber(L->top - 1)) |
| 282 | changenvalue(L->top - 2, | ||
| 283 | luaO_arith(op, nvalue(L->top - 2), nvalue(L->top - 1))); | ||
| 284 | else | ||
| 285 | luaV_arith(L, L->top - 2, L->top - 2, L->top - 1, op - LUA_OPADD + TM_ADD); | ||
| 282 | L->top--; | 286 | L->top--; |
| 283 | lua_unlock(L); | 287 | lua_unlock(L); |
| 284 | } | 288 | } |
