Jump to content




if stament is not working like expected


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

#1 Termanater13

  • Members
  • 64 posts

Posted 23 December 2012 - 07:28 AM

I am working on getting a building program working and for some reason 2 lines are not working as expected. but the rest works fine as expected.
Spoiler
If statmenst on line 18 and 25 are to check if the for loop is at the end and if it is not exicute the lines of code otherwise ignore them if it is at the end. this uses my own turtle movement API, "PI".
API functions used:
  • PI.mFw() = move Forward
  • PI.tL() == turn Left
  • PI.tR() == turn Right
  • PI.pBD() = place Block Down
  • PI.bBD() = break Block Down


#2 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 23 December 2012 - 07:33 AM

You need to tonumber numerical arguments to compare them correctly:

x = tonumber(args[1])

#3 remiX

  • Members
  • 2,076 posts
  • LocationSouth Africa

Posted 23 December 2012 - 07:33 AM

Try changing these two lines:
x=tArgs[1]
z=tArgs[2] 
to
x=tonumber(tArgs[1])
z=tonumber(tArgs[2]) 


#4 Termanater13

  • Members
  • 64 posts

Posted 23 December 2012 - 07:38 AM

that fixed it, I never thought of that. I thought if I passed a number it would work as a number not a string.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users