This repository includes documentation extensions for virtually every single built-in Lua function in Star Wars Battlefront II (2005). The only ones that are currently undocumented are many of the shell-exclusive callbacks, but there is pretty much no use for those anyway. Currently there exists an extension for Lua Development Tools (as a .doclua file) and Visual Studio Code (as a marketplace extension).
Because each IDE uses a different documentation framework, the features for each IDE differ slightly (see below).
Items that are bolded are identical across each IDE.
- IntelliSense-like function auto-completion. (finicky)
- Each function includes a description of what it does - some include thorough use-case examples.
- Functions with return values include descriptions of each return value.
- Function parameters are documented with their name, data type, and description.
- Snippets for all event callbacks (such as
OnCharacterSpawn).
- Nothing off the top of my head. ;-)
- IntelliSense-like function auto-completion.
- Each function includes a description of what it does - some include thorough use-case examples.
- Functions with parameters include auto-completion for each parameter.
- Parameters with predetermined values have dropdown-based value auto-fill.
- Functions with multiple return values include descriptions of each return value.
- Snippets for all event callbacks (such as
OnCharacterSpawn) - furthermore, each snippet includes auto-completion that sets up the callback's lambda function (e.g., 'function(object, killer)' for 'OnObjectKill') and instance values.
- Parameter descriptions - this is largely because VSCode does not yet seem to support individual parameter descriptions.
Save API\LuaDevelopmentTools\Battlefront2API.doclua (v1.0.0, latest) (right-click link & Save As) to the root of your project's source folder (or data_***\Common\scripts).
When saving the file, make sure the file extension is
.docluaand not.doclua.txt!
- Go to the extension's page on the Visual Studio Marketplace
- Click the
Installbutton - If you're prompted to allow Visual Studio Code to open, confirm the prompt
- Once Visual Studio Code has opened, click the
Installbutton, then theEnablebutton
OR
- Open Visual Studio Code
- Press
Ctrl+Pto open the Quick Open dialog - Type
ext install vscode-swbf2-lua-apito find the extension - Click the
Installbutton, then theEnablebutton
OR
- Press
Ctrl+Shift+Xto open the Extensions tab - Type
vscode-swbf2-lua-apito find the extension - Click the
Installbutton, then theEnablebutton
OR
- Open a command-line prompt
- Run
code --install-extension aarongilbert2012.vscode-swbf2-lua-api
If you think there are any missing or incorrectly-documented functions/parameters/return values, please file a bug report.
Please feel free to help out with the extensions if you'd like! Simply fork/clone the repo (.git link), make your changes, and submit a pull request.
Some notes:
- The VSCode extension directory is at
API\VSCode - The LDT extension directory is at
API\LuaDevelopmentTools - The file containing all of the VSCode snippets is at
API\VSCode\snippets\snippets.json - The file containing all of the LDT snippets is at
API\LuaDevelopmentTools\Battlefront2API.doclua - Documentation for creating VSCode snippets can be found HERE
- Documentation for creating LuaDoc (LDT) snippets can be found HERE

