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

Another "java.lang.ArrayIndexOutOfBoundsException" thread

Started by nukes2all, 26 August 2016 - 01:51 PM
nukes2all #1
Posted 26 August 2016 - 03:51 PM
So, I've been out of the lua game for quite a while, the first thing that I wanted to do to get the rust off of my was make a lumberjack.
I was streaming the process, so if you'd like to see the final product, I can link it.
But here's the code

http://pastebin.com/hdnsZh7H

I'm fairly certain the exception is occurring in the "turn()" function. But having never fully understood it, I'm not sure how to fix it, any tips?

Edited on 26 August 2016 - 03:48 PM
KingofGamesYami #2
Posted 26 August 2016 - 06:37 PM
You're recursively calling 'turn'. Don't do that - use a loop instead.

java.lang.arrayIndexOutOfBounds means you've overfilled the stack.