LuaJ String bugs
SquidDev opened this issue ยท 3 comments
This aren't bugs with ComputerCraft but with LuaJ. I understand that this isn't within the scope of this bug tracker, just thought it might be useful.
string.gmatch
will loop forever on non-consuming patterns (such as\n*
)\011
is not counted as whitespace.string.format
does not pad/truncate on string of floating point format codes (%s
,%f
,%g
, etc...)- Balanced matches (
%b
) throw an out of bounds exception on no match
I've got a set of fixes and test cases if you want to fix/test this. This doesn't correctly handle the %g
modifier.
I've also added a fix for string.find
returning the wrong index on a previous match (which I guess is what the string.find
and string.match
overrides in bios.lua
are for).
Fixed the string.find bug in my LuaJ fork and removed the bios.lua hacks. May merge in the other fixes later.
Fixed the infinite loop, whitespace not matching \v (this is actually caused by a typo in the original code, which i corrected), and the out of bounds exception. I will not be implementing the string.format fixes due to code complexity and relative unimportance.