eris: change sort order for lua_genlt
This commit is contained in:
@@ -312,6 +312,17 @@ LUA_API void lua_arith (lua_State *L, int op) {
|
|||||||
lua_unlock(L);
|
lua_unlock(L);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int sortorder(int t) {
|
||||||
|
switch (t) {
|
||||||
|
case LUA_TNIL: return 0;
|
||||||
|
case LUA_TNUMBER: return 1;
|
||||||
|
case LUA_TSTRING: return 2;
|
||||||
|
case LUA_TBOOLEAN: return 3;
|
||||||
|
case LUA_TTABLE: return 1000000;
|
||||||
|
default: return t+1000;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
LUA_API int lua_genlt (lua_State *L, int index1, int index2) {
|
LUA_API int lua_genlt (lua_State *L, int index1, int index2) {
|
||||||
StkId o1, o2;
|
StkId o1, o2;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
@@ -321,7 +332,7 @@ LUA_API int lua_genlt (lua_State *L, int index1, int index2) {
|
|||||||
int t1 = ttypenv(o1);
|
int t1 = ttypenv(o1);
|
||||||
int t2 = ttypenv(o2);
|
int t2 = ttypenv(o2);
|
||||||
if (t1 != t2) {
|
if (t1 != t2) {
|
||||||
i = (t1 < t2);
|
i = (sortorder(t1) < sortorder(t2));
|
||||||
} else if (t1 == LUA_TNUMBER) {
|
} else if (t1 == LUA_TNUMBER) {
|
||||||
i = luai_numlt(L, nvalue(o1), nvalue(o2));
|
i = luai_numlt(L, nvalue(o1), nvalue(o2));
|
||||||
} else if (t1 == LUA_TSTRING) {
|
} else if (t1 == LUA_TSTRING) {
|
||||||
|
|||||||
Reference in New Issue
Block a user