sven wrote:
Ok, here's a super-simple pretty-printed version of the internal
TECHNOLOGY table. It takes out all the shorthand and functional programming tricks in ~TECHNOLOGY.lua, and just gives you the raw data. (This takes about 10 seconds for me to export.)
And here's a
JSON encoding. It's worth being aware that JSON only supports string keys in its assosiative arrays, while Lua allows you to mix integer keys with other key types, bluring the line between "arrays" and more general "tables". There are a few places where the TECHNOLOGY table includes mixed integer and string keys, specifically, the "prereq" tables, which may include a list of other tech prereqs, plus a "type" field that will be either "all_of" or "one_of", depending on the nature of the prereq.
In these cases, I've told my JSON exporter to convert the integer keys to strings, so the lua table:
Code: Select all
{
"Hadron Cohesion",
"Plasma Focusing",
"Zero-Point Energy",
type = "all_of"
}
Is converted to JSON as:
Code: Select all
{
"1": "Hadron Cohesion",
"2": "Plasma Focusing",
"3": "Zero-Point Energy",
"type": "all_of"
}
Which is a little weird. But working around that may well be easier than trying to find a parser that can handle generic Lua tables. Um, in any case, happy coding
