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

[Error] Attempt to index (? a nil value)

Started by ebernerd, 30 March 2013 - 04:45 AM
ebernerd #1
Posted 30 March 2013 - 05:45 AM
I am making a computer that sends file contents as a message through rednet. Here is the code for the server
Spoiler


rednet.open("top")
while true do
  event, id, message = os.pullEvent()
  if event == "rednet_message" then
    if message == "startup" then
      f = fs.open("startup","r")
      file = f.readAll() --WHERE MY ERROR IS
      f.close()
      rednet.send(id,file)
    end
  end
end

I am getting the error on line 7
What is wrong?
Thanks in advance!
-Viextra
ebernerd #2
Posted 30 March 2013 - 05:47 AM
Nevermind. I fixed it.