Jump to content




Unserializing tables doesn't work


4 replies to this topic

#1 Windows10User

  • Members
  • 62 posts
  • LocationC:\Minecraft\saves\stuff\computer

Posted 04 October 2018 - 05:19 PM

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?

#2 SquidDev

    Frickin' laser beams | Resident Necromancer

  • Members
  • 1,427 posts
  • LocationDoes anyone put something serious here?

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 Windows10User

  • Members
  • 62 posts
  • LocationC:\Minecraft\saves\stuff\computer

Posted 04 October 2018 - 06:30 PM

View PostSquidDev, 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 EveryOS

  • Members
  • 570 posts
  • LocationOver there ->

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 Windows10User

  • Members
  • 62 posts
  • LocationC:\Minecraft\saves\stuff\computer

Posted 05 October 2018 - 11:04 AM

View PostEveryOS, 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