This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Imred Gemu's profile picture

[CC 1.5][ssp]Program crash using string.find("any string", "[")

Started by Imred Gemu, 27 June 2013 - 05:12 PM
Imred Gemu #1
Posted 27 June 2013 - 07:12 PM
Version: [MC 1.4.7][CC 1.5][FTB DW20 5.3.2] Description: when working on a program I used string.find(sExample, "["), by entering the character "[" as the second argument to string.find() an error was thrown reading "vm error: java.lang.ArrayIndexOutOfBoundsException: 1", if this piece of code is used in the lua prompt the error simply is "1" in the color red. I have not tried this in the latest version but I am assuming it is still an issue since I have not seen anything in the change logs addressing it. Reproduction: create a file: arg1 = anystring, arg2 = "[" string.find(arg1, arg2), save and run, this program will crash.
Cloudy #2
Posted 27 June 2013 - 10:00 PM
LuaJ bug, don't care.
AfterLifeLochie #3
Posted 29 June 2013 - 01:23 AM
This isn't a LuaJ bug - it's a malformed pattern causing your issue. You should read up on how Patterns work, particularly the Magic Characters section - and you'll find the solution to your problem.
Cloudy #4
Posted 29 June 2013 - 01:29 AM
But the nature of the error message is still a LuaJ bug, but it wouldn't happen if you were using it properly!