Posted 24 December 2012 - 11:34 AM
Hey Guys,
I'm having a litte problem that is really limiting me in what i can do in CC:
I've made a test program to test some stuff for an api i want to make but every time i run it, it gives me an error message (line 20: expected string)
If i put it in quotation marks there it just titles the file "id" and not 1 or whatever the computer id is.
Whats really wierd is the fact that i get the same error message even when i copy paste example code in my skript
The last time i got this problem i somehow worked around it but now i dont know what i could do to make it work
Thanks in advance if someone can help me/explain the problem, im really desperate and tried many things but nothing worked.
I'm having a litte problem that is really limiting me in what i can do in CC:
I've made a test program to test some stuff for an api i want to make but every time i run it, it gives me an error message (line 20: expected string)
local posdata = {}
local data = {}
local id = os.getComputerID()
function createPos()
rednet.open("right")
local x,y,z = gps.locate(2)
rednet.close("right")
posdata[1] = x
posdata[2] = y
posdata[3] = z
posdata[4] = dir
end
function savePos()
createPos()
local file = fs.open(id,"w") <------here is line 20
test = textutils.serialize(posdata)
file.writeLine(test)
file.close()
end
If i put it in quotation marks there it just titles the file "id" and not 1 or whatever the computer id is.
Whats really wierd is the fact that i get the same error message even when i copy paste example code in my skript
function save(table,name)
local file = fs.open(name,"w")
file.write(textutils.serialize(table))
file.close()
end
The last time i got this problem i somehow worked around it but now i dont know what i could do to make it work
Thanks in advance if someone can help me/explain the problem, im really desperate and tried many things but nothing worked.