12 posts
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.
3057 posts
Location
United States of America
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.
1080 posts
Location
In the Matrix
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.
89 posts
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.
12 posts
Posted 24 July 2015 - 04:36 PM
I found that the problem was me passing an array as the key in a table.