spiwn / FactorioApiScraper

A small script that goes through the Factorio API documentation html and exports a json intented to be used by autocomplete extensions such as https://github.com/simonvizzini/vscode-factorio-lua-api-autocomplete
MIT License
3 stars 1 forks source link

context.json data model #6

Open zackgomez opened 3 years ago

zackgomez commented 3 years ago

Hi I've been working further to ingest context.json and produce my own flavor of outputs. In that process I have noticed a couple of inconsistencies/issues/potential improvements to the data.

I'm able to work around/special case these, but I'm reporting them to you for your information.

LuaItemStack https://lua-api.factorio.com/latest/LuaItemStack.html has a couple of return types that might require some more parsing or special handling. Specifically it produces types with spaces in them.

"type": {
  "value": [
    "blueprint entity"
  ],
  "type": "Array"
},

CustomDictionary and CustomArray are encoded like

"type": {
  "value": [
    "CustomDictionary",
    "string",
    "LuaTechnology"
  ]
},

and

"type": {
  "value": [
    "CustomArray",
    "of",
    "Alignment"
  ]
},

while they might be more consistenly represented like

"type": {
  "type": "CustomDictionary",
  "value": [
    "string",
    "LuaTechnology"
  ]
},

to match

"type": {
  "type": "Table"
  "value": [
    "string",
    "uint"
  ],
},
spiwn commented 3 years ago

Thank you. There are a lot of such problems. Currently I have a list of around 150 elements that are not parsed correctly and generate less than satisfactory output. I intend to address them all.