Posted 04 July 2012 - 02:41 AM
I have the following code:
and receive the following error:
any idea why. I'm new to lua but not to programming, any help will be appreciated
local mon = peripheral.wrap("top")
local oil = 0
local coke = 0
function redstoneEvent(p1, p2)
if(rs.testBundledInput("right", colors.lightGray)) == true then
coke = coke + 1
end
if(rs.testBundledInput("right", colors.green)) == true then
oil = oil + 1
end
end
repeat
mon.clear()
mon.setCursorPos(1,1)
mon.write("Oil gained:")
mon.write(oil)
mon.setCursorPos(1,2)
mon.write("Coke gained: ")
mon.write(coke)
local event, p1, p2 = os.pullEvent()
if event == "redstone" then
redstoneEvent(p1, p2)
end
until event == "char" and p1 == "x"
mon.clear()
os.shutdown
and receive the following error:
shell:17: vm error: bios:38 vm error:
java.lang.ArrayIndexOutOfBoundsException: 256
any idea why. I'm new to lua but not to programming, any help will be appreciated