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

Getting java.lang.ArrayIndexOutOfBoundsException: 0

Started by ilgazzi, 22 July 2015 - 05:26 PM
ilgazzi #1
Posted 22 July 2015 - 07:26 PM
I am making a program for refilling essentia from thaumcraft but I am getting a "Java Exception recieved. java.lang.ArrayIndexOutOfBoundsException: 0
The code is here. Thanks.
KingofGamesYami #2
Posted 22 July 2015 - 11:15 PM
Add some prints to your code to see what was executing before the error occurred. This will help find what part of the code is erroring.
Dragon53535 #3
Posted 22 July 2015 - 11:37 PM
To give an example of what KoGY is asking for is say I have this long bit of code that is built to open a door, yet it errors in the way that yours does (Probably wouldn't, just an example). Since I don't know where it is, I would stick print statements with unique messages in my code, and whichever activated last is the area I should be looking.

--#This is going to be a sort of terrible example
local s = 'hi'
print("First Print")
for a,v in pairs(s) do
  print(v)
end
print("Second Print")
So lets say this code ran, and gave an error likes yours (Still wouldn't, just an example). I would see that First Print was printed out, yet Second Print was not. Which means that my problem is in the area between that. If the code was longer, I would stick more print statements inside the area between First Print and Second Print (While getting rid of First Print and Second Print) and then repeat until I find the exact line.
Lion4ever #4
Posted 23 July 2015 - 01:25 AM
I do not have any knowledge of the peripheral you are using there, but since it is a java error and not a lua one, it might be that the peripheral has some issues. Most likely it exspects a parameter and did not check if it got one or there is a situation in the minecraft world the peripherie author did not think of.

Other than that you could cause the same error with an infinite recursive function call, but that is not the case.
ilgazzi #5
Posted 24 July 2015 - 04:36 PM
I found that the problem was me passing an array as the key in a table.