So, right now I have this code:
local tmp = fs.open("filesystem.ufs", "r")
local ufs = textutils.unserialize(tmp.readAll())
tmp.close()
It runs "fine". However, when I try to use the ufs table, it seems to be nil.
I have CC build 5 1.12.2 from http://cc.crzd.me
Why does this happen?
1
Unserializing tables doesn't work
Started by Windows10User, Oct 04 2018 05:19 PM
4 replies to this topic
#1
Posted 04 October 2018 - 05:19 PM
#2
Posted 04 October 2018 - 06:06 PM
Without knowing what the file looks like, we can't say for sure. However, at a guess it's not a valid table - double check that everything looks correct within filesystem.ufs.
#3
Posted 04 October 2018 - 06:30 PM
SquidDev, on 04 October 2018 - 06:06 PM, said:
Without knowing what the file looks like, we can't say for sure. However, at a guess it's not a valid table - double check that everything looks correct within filesystem.ufs.
This is the table:
{ "myfile.lua" = { name = "myfile.lua", type = "file", contentloc = "90285", }, filecontent = { "90285" = "print(\"Hello!\")", }, }
Everything looks correct to me.
#4
Posted 04 October 2018 - 06:56 PM
Try this:
{ ["myfile.lua"] = { name = "myfile.lua", type = "file", contentloc = "90285" }, filecontent = { ["90285"] = "print(\"Hello!\")" } }
Edited by EveryOS, 04 October 2018 - 06:59 PM.
#5
Posted 05 October 2018 - 11:04 AM
EveryOS, on 04 October 2018 - 06:56 PM, said:
Try this:
{ ["myfile.lua"] = { name = "myfile.lua", type = "file", contentloc = "90285" }, filecontent = { ["90285"] = "print(\"Hello!\")" } }
Did that, fixed a few bugs I just found and it works! Thanks for the help, brotha.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users