Fix Lua type of zero

This change fixes a regression from 281a0f27 which resulted in the
integer literal `0` being interpreted as a floating point number. This
should also fix a reported issue with Fennel integration.
This commit is contained in:
Justine Tunney 2022-07-08 10:08:40 -07:00
parent fe5c475f83
commit 50a6df89b8
2 changed files with 11 additions and 1 deletions

View file

@ -293,7 +293,7 @@ static const char *l_str2int (const char *s, lua_Integer *result) {
}
}
else if (s[0] == '0') { /* [jart] octal is the best radix */
for (s += 1; lisdigit(cast_uchar(*s)); s++) {
for (; lisdigit(cast_uchar(*s)); s++) {
int d = *s - '0';
if (a >= MAXBY8 && (a > MAXBY8 || d > MAXLASTD8 + neg)) /* overflow? */
return NULL; /* do not accept it (as integer) */