GLuaFixer icon indicating copy to clipboard operation
GLuaFixer copied to clipboard

for loops bug

Open Srlion opened this issue 2 years ago • 1 comments

Linter allows this:

fori = 1 , 3do
end

It's kinda weird, but the problem is probably not with the for loop, but with 3do end

EDIT: yep the problem is with "3do end" as formatter formats it into:

fori = 3
do
end

Srlion avatar Apr 20 '24 17:04 Srlion

Ah, indeed fori = 1, 3 is valid Lua, but the 3do part is not. Lua itself complains about it being a malformed number. glualint is fine lexing it as the number 3 followed by the keyword do.

I think the difference is in that Lua number parsing works like "parse a number followed by a bunch of letters, then check later if those letters make sense". Glualint parses numbers as the very precise set of characters in the order that they are allowed.

FPtje avatar Apr 21 '24 11:04 FPtje

Fix released in https://github.com/FPtje/GLuaFixer/releases/tag/1.29.0

FPtje avatar Jul 03 '24 19:07 FPtje