Jump to content




Expected number?


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

#1 Mackan90096

  • Signature Abuser
  • 518 posts
  • LocationIn my basement.

Posted 13 May 2015 - 03:09 PM

Okay. I'm making a program here. It uses the modem api to send messages.
Currently, I'm implementing a command that allows users to change their channel.
But, I get the error "Expected number" on line 108. I can't for my life figure out why.
Thanks for help.
- Mackan

Code

#2 KingofGamesYami

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

Posted 13 May 2015 - 03:58 PM

Line 47:
      channel = tonumber(args[1])

If args[ 1 ] was not a number, channel is now nil, resulting in you passing nil, nil to modem.transmit on line 108.

Suggested Fix: Change line 47
      channel = tonumber(args[1]) or channel

Edited by KingofGamesYami, 13 May 2015 - 04:04 PM.


#3 Mackan90096

  • Signature Abuser
  • 518 posts
  • LocationIn my basement.

Posted 14 May 2015 - 11:03 AM

Ah, that fixed it! Thanks!





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users