Fix "attempt to perform arithmetic on a number value" errors
Not best fix but i don't know why setnumV breaks here
This commit is contained in:
1 parent
d156b716f6
commit
a9429caf09
2 files changed
+9
-5
No files matched your search
@@ -9,6 +9,8 @@
|
||||
#define lib_table_c
|
||||
#define LUA_LIB
|
||||
|
||||
#include "../console.h"
|
||||
|
||||
#include "lua.h"
|
||||
#include "lauxlib.h"
|
||||
#include "lualib.h"
|
||||
@@ -72,7 +74,9 @@ LJLIB_CF(table_maxn)
|
||||
lua_Number n = numberVnum(&node[i].key);
|
||||
if (n > m) m = n;
|
||||
}
|
||||
setnumV(L->top-1, m);
|
||||
/* This should be setnumV but for some reason it makes numbers broken,
|
||||
* which causes "attempt to perform arithmetic on a number value" errors */
|
||||
setintV(L->top-1, m);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -249,11 +249,11 @@ static int lj_carith_meta(lua_State *L, CTState *cts, CDArith *ca, MMS mm)
|
||||
}
|
||||
for (i = 0; i < 2; i++) {
|
||||
if (ca->ct[i] && tviscdata(L->base+i)) {
|
||||
if (ctype_isenum(ca->ct[i]->info)) isenum = i;
|
||||
repr[i] = strdata(lj_ctype_repr(L, ctype_typeid(cts, ca->ct[i]), NULL));
|
||||
if (ctype_isenum(ca->ct[i]->info)) isenum = i;
|
||||
repr[i] = strdata(lj_ctype_repr(L, ctype_typeid(cts, ca->ct[i]), NULL));
|
||||
} else {
|
||||
if (tvisstr(&L->base[i])) isstr = i;
|
||||
repr[i] = lj_typename(&L->base[i]);
|
||||
if (tvisstr(&L->base[i])) isstr = i;
|
||||
repr[i] = lj_typename(&L->base[i]);
|
||||
}
|
||||
}
|
||||
if ((isenum ^ isstr) == 1)
|
||||
|
||||
Reference in new issue
Block a user