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

[Error] Password Protection: Attempt to call nil?

Started by ScribbleQ, 07 November 2012 - 02:15 AM
ScribbleQ #1
Posted 07 November 2012 - 03:15 AM
Alright, I've tried to solve this, but it's very weird to me. I've edited the program startup (when the computer turns on) with this bit of code to password protect my computer:

pullEvent = os.pullEvent
os.pullEvent = os.pullEventRaw -- denies control+T
function clear()
term.clear()
term.setCursorPos(1,1)
end
local password, correct = "", "password"
while password ~= correct do
clear()
print("Please Enter Password.")
term.setCursorPos(1,2)
print("-----------------------------")
term.setCursorPos(1,3)
password = read("*")
if password == correct then
  term.setCursorPos(1,1)
  term.clearLine()
  print("Access Granted")
  sleep(1)
  clear()
else
  term.setCursorPos(1,1)
  term.clearLine()
  print("Incorrect Password.")
  sleep(1)
  term.setCursorPos(1,3)
  term.clearLine()
end
end
os.pullEvent = pullEvent

The weird part is, if I shutdown my computer, then right-click it again, the computer acts as if nothing is wrong. But when I reboot it, I get the error: "reboot:3: attempt to call nil". what do I do?
Jan #2
Posted 07 November 2012 - 03:42 AM
reboot:3: attempt to call nil

This is what the reboot program looks like by default in cc 1.46
(in computercraft zip /lua/rom/programs/ )

if term.isColour() then
term.setTextColour( colours.yellow )
end
print( "Goodbye" )
term.setTextColour( colours.white )
sleep( 1 )
os.reboot()
There are no errors on the third line, so maybe you edited the reboot file or something?
Also try: lua
and then enter 'os.reboot'
see if that works.
ScribbleQ #3
Posted 07 November 2012 - 04:08 AM
Yeah, I'm pretty sure that it's a server side error.
I have my own server (I use the tekkit version of computercraft, don't hate me) and it gives me no errors there.
Lyqyd #4
Posted 07 November 2012 - 04:48 AM
Disregard this post.