Jump to content




[Resolved] io:47: Unsupported Format error

help

  • You cannot reply to this topic
No replies to this topic

#1 KDJSAIUH

  • Members
  • 35 posts

Posted 01 January 2015 - 03:21 AM

Ok, first off I haven't been on these forums for a while and I think Lyqyd was kind of glad. Anyways, I needed to try and write a code for something and it required a config file, so I went on the web and found a video by NDFJay (https://www.youtube....h?v=NQDLyMcM-I4) on the subject. However, when I entered the desired code from the video and opened it it threw:
io:47: Unsupported Format at me.


Here's my code:
local w,h = term.getSize()
local key = "1234567890"
local function getTable(path)
if fs.exists(path) then
  local file = io.open(path, "r")
  local lines = {}
  local i = 1
  local line = file:read("*1")
  while line ~= nil do
   lines[i] = line
   line = fs.read("*1")
   i = i + 1
  end
  file:close()
  return lines
end
return {}
end

function replaceLine(path, n, text)
local lines = getTable(path)
lines[n] = text
writeFromTable(path, lines)
end
function fWrite( path, text )
local file = config
fs.delete("path")
fs.open("config", "w")
replaceLine("config",1,"Code: "..key)
fs.close()
end
fWrite()

Help would be much appreciated. This is not my code so don't facepalm at me :P.
~kaioo1312

EDIT : Found http://www.computerc...-with-an-error/
which someone had a the exact same problem with the same code. Lyqyd pointed out that ("*1") is not valid but ("*l") is. Apparently it is there is no difference between l and 1 in Sublime Text 3. Fixed my own problem. Thanks Lyqyd!
~kaioo1312

Edited by kaioo1312, 01 January 2015 - 03:32 AM.






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users