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

[ERROR] function arguments expected

Started by dcleondc, 11 October 2012 - 10:22 PM
dcleondc #1
Posted 12 October 2012 - 12:22 AM
here is my code pastebin.com/gAQ981TJ

and my error is in the title
Orwell #2
Posted 12 October 2012 - 12:31 AM
the variable 'timeout' is not being declared.
MysticT #3
Posted 12 October 2012 - 12:33 AM

Id, Name, Dis = rednet.recieve(timeout)
Id, Code, Dis = rednet.redieve(timeout)
it's rednet.receive, and the timeout it's only useful if you actually have a timeout, not just an undefined variable.


file:close
missing brackets.

Fixed code:

local id, name, code
id, name = rednet.receive()
id, code = rednet.receive()

print("Code from ID: ", id)
print("Code will be saved as ", name)
sleep(0.5)

local file = fs.open(name, "w")
if file then
  file.write(code)
  file.close()
  print("Saved as ", name)
else
  print("Error saving to ", name)
end