1

I have searched the web and particularly this:

Table Serialiazation

and none of them work.

I am trying the simplest of tables as follows:

THIS IS THE INPUT.LUA FILE

{
    ["customers"] =
    {
        ["name"] = "John Smith",
        ["age"] = 45
    },
    {
        ["name"] = "Susan Jones",
        ["age"] = 34
    },
}

Where x = input.lua

And I have in my Lua an:-

if(type (x) == "table" then
   dostuff()
else
  return "this is not a table"
end

And all I get with all the deserializers is the "this is not a table".

I am now writing my own deserializer, which will have to handle all the escaping characters, and the beginning of tables, and the tracking of nested tables and the typing of values - why????

Am I a moron - which part of the table serialiazion routines did I misunderstand??

8-Bit Borges
  • 9,643
  • 29
  • 101
  • 198
MatthewR
  • 11
  • 1
  • I should have added that before I run x through the if statement, I have tried to deserialize it using methods from the Table Serialiazation site. – MatthewR Mar 13 '18 at 05:00
  • You will have to show more code in order for us to help you. Make a MWE (a minimum working example) with the code reduce to the bare minimum. This should contain something around 10 lines, perhaps plus your input data. – pschulz Mar 13 '18 at 06:28
  • where do you define input.lua which you assign to x? – Piglet Mar 13 '18 at 13:45
  • Your example would not run due to the improper whitespace and `(`. That aside, what does `print(type(x))` tell you, and what exactly are you defining as `x`? – Nijikokun Mar 14 '18 at 01:50

0 Answers0