Page 1 of 1

[Doc] JSON version of lua-api documentation

Posted: Sat Jul 14, 2018 9:43 pm
by cyfrov
Any chance that the devs can provide JSON structured variants of the lua API doc?
i.e. the current api documentation is at:
https://lua-api.factorio.com/${VERSION}/${OBJECT}.html
let's have a machine friendly version at:
https://lua-api.factorio.com/${VERSION}/${OBJECT}.json

Main advantage is that it would make it much easier to feed the latest API into a your favorite editor extension.

Re: [Doc] JSON version of lua-api documentation

Posted: Tue Oct 02, 2018 9:56 pm
by Rseding91
The current docs system directly generates html so there's no simple "output it as JSON instead". If one of the other devs want to write that logic they can but until then this isn't going to happen.

Re: [Doc] JSON version of lua-api documentation

Posted: Tue Oct 22, 2019 1:21 pm
by eradicator
Has anything changed on that topic or has anyone written an html parser for this?

Re: [Doc] JSON version of lua-api documentation

Posted: Tue Oct 22, 2019 2:42 pm
by Sanqui
Do you have an example of the exact format you'd like? E.g. some that is already well supported by editors.

Re: [Doc] JSON version of lua-api documentation

Posted: Tue Oct 22, 2019 2:47 pm
by Bilka
Sanqui wrote:
Tue Oct 22, 2019 2:42 pm
Do you have an example of the exact format you'd like? E.g. some that is already well supported by editors.
This perhaps: https://github.com/simonvizzini/vscode- ... aster/data

Re: [Doc] JSON version of lua-api documentation

Posted: Tue Oct 22, 2019 2:54 pm
by Sanqui
I think this makes a lot of sense and I could do it sometime, so I'll move this to the normal forum

Re: [Doc] JSON version of lua-api documentation

Posted: Tue Oct 29, 2019 4:51 pm
by eradicator
(Sorry for the late answer)
Sanqui wrote:
Tue Oct 22, 2019 2:42 pm
Do you have an example of the exact format you'd like? E.g. some that is already well supported by editors.
No i don't have any particular format requirement beyond "easily parsable". I thought about including it in an extension of my "/sudo" mod for which i'd have to reparse it anyway. As the engine supports lua and json easily, either of both would be mighty fine. I use Notepad++ as an editor but it uses xml for auto-completition hints, so i'd rather generate that xml myself from a simpler format.
Sanqui wrote:
Tue Oct 22, 2019 2:54 pm
I think this makes a lot of sense and I could do it sometime, so I'll move this to the normal forum
Awesome! That VScode json format linked by @Bilka looks reasonably easy to parse. And VScode is pretty popular too.

Re: [Doc] JSON version of lua-api documentation

Posted: Fri Aug 20, 2021 1:05 pm
by Therenas
This is a thing now!

Re: [Doc] JSON version of lua-api documentation

Posted: Fri Aug 20, 2021 4:25 pm
by asdff45
That is great! Unfortunately not retroactive, but awesome fo the future.
Can we have such a json output for prototype definitions as well (even though they are only in the wiki and mostly manually updated)?

Re: [Doc] JSON version of lua-api documentation

Posted: Fri Aug 20, 2021 6:03 pm
by eradicator
asdff45 wrote:
Fri Aug 20, 2021 4:25 pm
Can we have such a json output for prototype definitions as well (even though they are only in the wiki and mostly manually updated)?
I would still love this even if it's a link on the wiki page "download json" and can't be packaged with normal releases (update cycles etc).

Re: [Doc] JSON version of lua-api documentation

Posted: Sat Aug 21, 2021 6:26 pm
by Therenas
asdff45 wrote:
Fri Aug 20, 2021 4:25 pm
That is great! Unfortunately not retroactive, but awesome fo the future.
Can we have such a json output for prototype definitions as well (even though they are only in the wiki and mostly manually updated)?
I'd have liked to make it work retroactively, but unfortunately getting this to work well required extensive adjustments of large parts of the documentation, which the old releases won't have, so their docs would be much less functional.

Regarding your second point, who knows what the future brings.

Re: [Doc] JSON version of lua-api documentation

Posted: Sat Aug 21, 2021 6:33 pm
by Rseding91
Side thing; what reason would anyone have for wanting old versions of the Lua API in machine readable format?

Re: [Doc] JSON version of lua-api documentation

Posted: Tue Aug 24, 2021 9:07 am
by asdff45
I had that available for my intellij plugin, but i can just drop support for those old verions. I don't think people are still developing for them.