Over the past few months I have been working on improving the quality of the documentation FSO automatically generates for the scripting API. The most important basic feature of that was to add a JSON generator in addition to the existing HTML one for the documentation. This allows to write external tools that take this information and do something useful with it. My use case was to generate type definitions for both Lua and TypeScript.
I wrote a small tool that takes the JSON generated by FSO and writes another file that can be used for getting much better coding assistance when writing scripts for FSO.
This tool is written in TypeScript and is published on npm:
https://www.npmjs.com/package/fso-ts-generatorIf you install that globally you will get a
fso-typings command line tool. The built-in help messages should hopefully be sufficient...
The Lua generator was written specifically for this IntelliJ plugin which I find very useful for writing scripts for FSO:
https://plugins.jetbrains.com/plugin/9768-emmyluaIf you use the typings generator then simply make it generate the type information to "data/api/fso.lua" and the plugin will pick up the definitions and offer you code completion for most API functions.
Wait, why TypeScript?
Because of this:
https://github.com/TypeScriptToLua/TypeScriptToLuaThat is a compiler that translates TypeScript to Lua which was the original reason I built the JSON support but never got around to actually using it "in production".
That is all,
Have a nice day
![:p](https://www.hard-light.net/forums/Smileys/HLP/tongue.gif)