diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2014-11-25 12:51:33 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2014-11-25 12:51:33 -0200 |
commit | fd179ab4b89ff39740aec11623863b5c06098479 (patch) | |
tree | 8445d49c4ea78a3e6e81072d7454618488d8971c | |
parent | bf163ea7f0b1ba56f684b134ee7688f84ef74ac4 (diff) | |
download | lua-fd179ab4b89ff39740aec11623863b5c06098479.tar.gz lua-fd179ab4b89ff39740aec11623863b5c06098479.tar.bz2 lua-fd179ab4b89ff39740aec11623863b5c06098479.zip |
clearer notation for "compare" instruction
-rw-r--r-- | ltests.c | 9 |
1 files changed, 6 insertions, 3 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ltests.c,v 2.196 2014/11/11 17:15:06 roberto Exp roberto $ | 2 | ** $Id: ltests.c,v 2.197 2014/11/14 18:15:17 roberto Exp roberto $ |
3 | ** Internal Module for Debugging of the Lua Implementation | 3 | ** Internal Module for Debugging of the Lua Implementation |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -1060,7 +1060,7 @@ static int Cfunck (lua_State *L, int status, lua_KContext ctx); | |||
1060 | ** LUA_OPUNM -> _ | 1060 | ** LUA_OPUNM -> _ |
1061 | ** LUA_OPBNOT -> ! | 1061 | ** LUA_OPBNOT -> ! |
1062 | */ | 1062 | */ |
1063 | static char ops[] = "+-*%^/\\&|~<>_!"; | 1063 | static const char ops[] = "+-*%^/\\&|~<>_!"; |
1064 | 1064 | ||
1065 | static int runC (lua_State *L, lua_State *L1, const char *pc) { | 1065 | static int runC (lua_State *L, lua_State *L1, const char *pc) { |
1066 | char buff[300]; | 1066 | char buff[300]; |
@@ -1102,9 +1102,12 @@ static int runC (lua_State *L, lua_State *L1, const char *pc) { | |||
1102 | luaL_checkstack(L1, sz, msg); | 1102 | luaL_checkstack(L1, sz, msg); |
1103 | } | 1103 | } |
1104 | else if EQ("compare") { | 1104 | else if EQ("compare") { |
1105 | const char *opt = getstring; /* EQ, LT, or LE */ | ||
1106 | int op = (opt[0] == 'E') ? LUA_OPEQ | ||
1107 | : (opt[1] == 'T') ? LUA_OPLT : LUA_OPLE; | ||
1105 | int a = getindex; | 1108 | int a = getindex; |
1106 | int b = getindex; | 1109 | int b = getindex; |
1107 | lua_pushboolean(L1, lua_compare(L1, a, b, getnum)); | 1110 | lua_pushboolean(L1, lua_compare(L1, a, b, op)); |
1108 | } | 1111 | } |
1109 | else if EQ("concat") { | 1112 | else if EQ("concat") { |
1110 | lua_concat(L1, getnum); | 1113 | lua_concat(L1, getnum); |