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

Attempt to index a nil value, while checking if the value isnt nil?!?

Started by Lewisk3, 25 May 2016 - 06:52 PM
Lewisk3 #1
Posted 25 May 2016 - 08:52 PM
I keep getting the attemp to index a nil value error in an if statement that checks if the value isnt nil
please help!

link to code: http://pastebin.com/Viye5gAk

Look at line 53
Edited on 25 May 2016 - 06:59 PM
KingofGamesYami #2
Posted 25 May 2016 - 08:56 PM
I'm guessing the or is executing before the addition, for whatever reason.

Try changing it to:

(y+yd < 0) or (x+dx < 0)
Lewisk3 #3
Posted 25 May 2016 - 08:59 PM
I'm guessing the or is executing before the addition, for whatever reason.

Try changing it to:

(y+yd < 0) or (x+dx < 0)

thanks for the quick response it turns out the "dx" i got mixed up for with "xd" LOL
fixed that quickly, thanks for your help though.

i am getting another error now not sure why.
KingofGamesYami #4
Posted 25 May 2016 - 09:01 PM

map[y+yd]

is nil
Lewisk3 #5
Posted 25 May 2016 - 09:12 PM

map[y+yd]

is nil

OH i see, lol cant believe i didnt see that xD
thanks!
it all works perfect now :)/>