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

Out of Bounds

Started by classyjakey, 25 August 2014 - 11:44 AM
classyjakey #1
Posted 25 August 2014 - 01:44 PM
VERSION:
1.63
DESCRIPTION:
It kept saying CraftOS 1.6 then eventually errored 'bios:222: vm error: java.lang.ArrayIndexOutOfBoundsException: 32'
EXPECTED RESULT:
Just to launch the shell
REPRODUCTION STEPS:
put this in a startup file on a disk os.run( {}, "rom/programs/shell" ) then reboot
SCREENSHOT/VIDEO:
none needed
Lyqyd #2
Posted 25 August 2014 - 03:28 PM
Moved to Ask a Pro.

You've created a loop by not providing the shell "API" to the instance of the shell that you're starting. It therefore thinks that it is the first shell instance and runs the startup program again.
TheOddByte #3
Posted 25 August 2014 - 07:56 PM
I'm not even sure why you put that at startup, wouldn't it be better just to have a clean startup file?
You could fix this by doing this ( as mentioned above )

shell.run( "rom/programs/shell" )

And another thing, in the future you should use code tags for your code even though it may be one line or something it's easier to see.
You can either use the '<>' in the editor or manually put code tags around your code by using [.code] Code here [./code] ( without the period )
electrodude512 #4
Posted 02 September 2014 - 06:21 PM
I've gotten this error many times. It means stack overflow, right? Then why the 32? The maximum stack depth is surely greater than 32?
Edited on 02 September 2014 - 04:21 PM
Bomb Bloke #5
Posted 03 September 2014 - 02:07 AM
Depends on which stack you're talking about. I don't see why you'd ever need more than that amount of scripts running at once, so it seems a reasonable figure for, say, a program stack.

Truth be told, the error is a Java ArrayIndexOutOfBoundsException which happens to be triggered by a stack overflow (though those aren't the only possible causes of an out-of-bounds error). LuaJ just happens to stick its stacks in Java arrays, and doesn't bother to catch scenarios where those arrays have overfilled.