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:
Help would be much appreciated. This is not my code so don't facepalm at me :P/>.
~kaioo1312
EDIT : Found http://www.computercraft.info/forums2/index.php?/topic/21427-need-help-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
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.computercraft.info/forums2/index.php?/topic/21427-need-help-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 on 01 January 2015 - 02:32 AM