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

Computer Blanking: Too Many Variables?

Started by Tiin57, 28 July 2012 - 01:44 PM
Tiin57 #1
Posted 28 July 2012 - 03:44 PM
When I run this half-finished server code (half-finished as in all the current features are complete, but some planned features are nonexistent), my console prints the first line as expected, then stops. Do I have too many variables defined? I've looked over it a dozen times and still can't find any errors.

print("Starting server.")
-- Variable defining
local scrap, msg = rednet.receive()
local wpasso = fs.open("passwords", "a")
local rpasso = fs.open("passwords", "r")
local cwpass = wpasso.close()
local crpass = rpasso.close()
local readi = read()
local wpass = wpasso.write(readi)
local rpass = rpasso.readAll()
-- Choosing mode/defining modes
print("Choose a mode: write or read.")
if readi == "write" then
  print("Please input the new password.")
  wpasso.write(readi)
  print(rpass)
  print("Rebooting.")
  sleep(3.5)
  os.reboot()
elseif readi == "read" then
if msg == rpass then
  local time = os.time()
  local wlog = fs.open("log", "w")
  wlog.write(time)
  os.reboot()
else
  os.reboot()
end
else
print("Invalid option. Rebooting.")
sleep(1.5)
os.reboot()
end
I think I edited this properly. Please point out any formatting errors (and of course, coding errors)!
Pinkishu #2
Posted 28 July 2012 - 03:57 PM
rednet.receive pauses until it receives a rednet message
Tiin57 #3
Posted 28 July 2012 - 03:58 PM
OH. Duh. Thanks. That was pretty stupid. *clonks self on head*