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

Io Error

Started by CyborgAlex, 31 July 2013 - 07:14 AM
CyborgAlex #1
Posted 31 July 2013 - 09:14 AM
Hello again!I tried working with confing files,so i made a simple counting program,that is "Session Persistent".But i get a error.
Error:

io:27: Expected string, String

Code:

http://pastebin.com/sKpNwGQJ

I can`t figure out the problem.Please help me!
Alex
Bubba #2
Posted 31 July 2013 - 09:37 AM
–snip– Just realized I made a mistake. Hang on a moment. The io library is a wrapper for fs and you may want to take a look into that instead.

Edit: Here's the actual issue. On line 22 you have this:

fwrite(path, text)

However, the path variable does not exist in that function and instead called "pah".

local function writeFromTable(pah, t)
  local text = ""
  for _, line in pairs(t) do
      text = text..line.."\n"
  end
  fwrite(path, text)
end
CyborgAlex #3
Posted 31 July 2013 - 10:28 AM
thank you!