Hello!
I create objects through a factory and they have properties, these properties are a hash.
local properties = {card_hash = hash(card_string), suit = hash(card.suit), rank = card.rank}
When I create these objects I save them to a table and the table looks like:
hash: [/instance1] = { --[[0000026B9BDEE5F0]]
properties = { --[[0000026B9BDEDDA0]]
suit = hash: [s],
card_hash = hash: [2s],
rank = 2
},
position = vmath.vector3(130, 35, 0)
},
hash: [/instance2] = { --[[0000026B9BDEEF50]]
properties = { --[[0000026B9BDEE740]]
suit = hash: [h],
card_hash = hash: [3h],
rank = 3
},
position = vmath.vector3(200, 35, 0)
},
How can I convert data from a table to JSON?
Because if I just do json.encode(my_table) then I get an error: Cannot serialise userdata: table key must be a number or string
I tried to figure it out with this extension, but I still didn’t understand how to work with the hash.
Thanks!