Code: Select all
[ value1, value2, ... ]
Code: Select all
[]
Code: Select all
{}
Code: Select all
[ value1, value2, ... ]
Code: Select all
[]
Code: Select all
{}
Interesting to know! The prototype docs just specified some types to be array[union] which is how I ended up at the assumption that they are arrays and that tripped when trying to deserialize "{}" as an array.Rseding91 wrote: Sat Oct 07, 2023 3:08 am All types in data.raw are dictionaries with anything looking like an array being numeric-dictionaries
We use the term "array" to mean "you don't need to care about the key values" but Lua itself only supports dictionaries (actually hash-maps under the hood).BrainGamer_ wrote: Sat Oct 07, 2023 7:09 am Interesting to know! The prototype docs just specified some types to be array[union] which is how I ended up at the assumption that they are arrays and that tripped when trying to deserialize "{}" as an array.
Makes sense. I still need to care about it in some way tho since the JSON changes "type" from being an array to a map when the "array" (or internal hash-map) is emptyRseding91 wrote: Sat Oct 07, 2023 2:32 pm We use the term "array" to mean "you don't need to care about the key values"
Code: Select all
"flags":
[
"placeable-neutral",
"player-creation"
],
Code: Select all
"flags":
{},
Code: Select all
"flags":
[],
The fun thing is that this is not the only valid representation for this! Since Lua basically does everything with HashMaps like Rseding said you can have the following:moon69 wrote: Fri Nov 10, 2023 3:54 pmCode: Select all
"flags": [ "placeable-neutral", "player-creation" ],
Code: Select all
"flags":
{
1: "placeable-neutral",
2: "player-creation"
}
Code: Select all
"flags":
{
"1": "placeable-neutral",
"2": "player-creation"
}