Jump to content




[DEBUGGING]


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

#1 jadelade

  • Members
  • 43 posts

Posted 01 May 2013 - 11:55 AM

Hi,
I'm getting a error (attempt to perform arithmetic __add on number and nil) that i can't punch out of the program. i will put a indicator on with line the error is in

PS sorry if the long line are hard to read I don't know how to make them easier on the eyes.

Spoiler
local colorPal = {}

for i=1,16 do
  colorPal[string.sub("0123456789abcdef",i,i)] = 2^(i-1)
end

for actionRow=1,2 do
  for actionObject=1,4 do
	for picRow=1,5 do
	  for picPixel=1,5 do
		term.setCursorPos((actionObject-1)*6+27+picPixel,(actionRow-1)*6+1+picRow)
		term.setBackgroundColor(colorPal[string.sub(objectPics[actionRow][actionObject][picRow],picPixel,picPixel)])
		write(" ")
	  end
	end
  end
end

for actionObject=1,3 do
  for PicRow=1,5 do
	for picPixel=1,5 do
	  term.setCursorPos((actionObject-1)*6+27+picPixel,(2)*6+1+picRow)------------------------------------------------------------------------------------------------------ERROR
	  term.setBackgroundColor(colorPal[string.sub(objectPics[3][actionObject][picRow],picPixel,picPixel)])
	  write(" ")
	end
  end
end


#2 remiX

  • Members
  • 2,076 posts
  • LocationSouth Africa

Posted 01 May 2013 - 12:23 PM

Your for loop is this:
for PicRow=1,5 do
but you're accessing the variable as picRow. LuA is CasE SenSitiVe

Also with your term.setBackgroundColor calls:
term.setBackgroundColor(colorPal[string.sub(objectPics[actionRow][actionObject][picRow],picPixel,picPixel)])
Looks a bit wonky, the commas would error? Thats like accessing a table within a table within a table within a table within a table within a table

#3 jadelade

  • Members
  • 43 posts

Posted 01 May 2013 - 12:49 PM

gaaaaa i had lots of bugs that i put a capital in the wrong place and it took me a week to find them and one time 2 months
:wacko: Thanks





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users