Jump to content




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


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

#1 Lewisk3

  • Members
  • 150 posts

Posted 25 May 2016 - 07: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 by Lewisk3, 25 May 2016 - 07:59 PM.


#2 KingofGamesYami

  • Members
  • 3,002 posts
  • LocationUnited States of America

Posted 25 May 2016 - 07: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)


#3 Lewisk3

  • Members
  • 150 posts

Posted 25 May 2016 - 07:59 PM

View PostKingofGamesYami, on 25 May 2016 - 07:56 PM, said:

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.

#4 KingofGamesYami

  • Members
  • 3,002 posts
  • LocationUnited States of America

Posted 25 May 2016 - 08:01 PM

map[y+yd]

is nil

#5 Lewisk3

  • Members
  • 150 posts

Posted 25 May 2016 - 08:12 PM

View PostKingofGamesYami, on 25 May 2016 - 08:01 PM, said:

map[y+yd]

is nil

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





2 user(s) are reading this topic

0 members, 2 guests, 0 anonymous users