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

Getting An Error With Compuer.reboot()

Started by MikeCraftian, 16 November 2013 - 08:36 AM
MikeCraftian #1
Posted 16 November 2013 - 09:36 AM
Its a simple password program im coding myself Figered out several bugs using google but I can't get past this one

http://pastebin.com/Wpqmk1wp

It runs but when Input is given (either the input == delta or the else)
it ends:
computer.reboot()
end
but this gives an error at the line containing computer,reboot()

Could anyone give me the reason why?
Lyqyd #2
Posted 16 November 2013 - 02:46 PM
Try os.reboot(). You really should fix your program instead, though. Relying on os.reboot is a bad idea.
MikeCraftian #3
Posted 16 November 2013 - 06:35 PM
Im very new to lua in its whole what do you mean by fixing it?

Also the official wiki says: computer.reboot() I suppose its wrong then?
Lyqyd #4
Posted 16 November 2013 - 07:47 PM
Looked at the actual code. Why are you trying to reboot at all? You've got the code in a while loop, you should be able to just take those lines out and have it work. Are you getting computer.reboot from this section of the wiki? Those are an example of a computer peripheral interface wrapped into the variable "computer", so that's not what you want. The OS API has what you were trying to use, but I would still suggest removing the lines entirely, since you've got the code in a while loop already. Looks like you probably want to remove the quotes around "cba" down in that if statement, too, since with the quotes, it checks against the literal string "cba" instead of looking at the value in the cba variable.
MikeCraftian #5
Posted 17 November 2013 - 02:40 PM
Alright thank you I obviously made some mistakes and now it works :)/>