Jump to content




[Error] [Java] paintutils:3: vm error: java.lang.ArrayIndexOutOfBoundsException: 256


  • You cannot reply to this topic
3 replies to this topic

#1 Mackan90096

  • Signature Abuser
  • 518 posts
  • LocationIn my basement.

Posted 07 May 2013 - 05:31 AM

Hi! I'm trying to make a game.
I got this error:

paintutils:3: vm error:
java.lang.ArrayIndexOutOfBoundsException: 256

My lua code:

Spoiler

Oh, I'm also using CC-emu

Whats wrong?

#2 digpoe

  • Members
  • 92 posts

Posted 08 May 2013 - 08:53 AM

What's CC-emu? I haven't heard of it, and it would be helpful for me to know so I can help you :)

#3 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 08 May 2013 - 09:06 AM

I would say, at a quick glance, your problem is that you seem to be using recursion. Paintutils is not at fault.

So basically each time you call a function from within itself like so
local function a()
  -- do stuff
  a()
end
a()
the program's stack will eventually fill up until it cannot call anything anymore. you can also have cyclic recursion like so
local function a()
  -- do stuff
  b()
end
local function b()
  -- do stuff
  a()
end
b()
there is very few times is programming where we actually need to use recursion. Most times that people use it, it can be simply replaced with a loop. So this is your solution, make it use loops. example
local function a()
  -- do stuff
end
-- infinitely loop
while true do
  a()
end
or
local function a()
  -- do stuff
end
local function b()
  -- do stuff
  a()
end
while true do
  b()
end

Now there are other ways to solve this problem without using loops, but as they are a more 'advanced' topic I wont be detailing them, and as such I just suggest you modify your logical flow so that your program is using loops instead of recursion.

View Postdigpoe, on 08 May 2013 - 08:53 AM, said:

What's CC-emu? I haven't heard of it, and it would be helpful for me to know so I can help you :)
A recently abandoned project EDIT: idk how you have been around since May 2012 and haven't heard of it!

Edited by theoriginalbit, 08 May 2013 - 09:07 AM.


#4 digpoe

  • Members
  • 92 posts

Posted 08 May 2013 - 09:08 AM

View Posttheoriginalbit, on 08 May 2013 - 09:06 AM, said:

View Postdigpoe, on 08 May 2013 - 08:53 AM, said:

What's CC-emu? I haven't heard of it, and it would be helpful for me to know so I can help you :)
A recently abandoned project EDIT: idk how you have been around since May 2012 and haven't heard of it!

Ah, thanks. I joined but then didn't use the account that I created until a while ago xP





2 user(s) are reading this topic

0 members, 2 guests, 0 anonymous users