Definition files for LUA scripting in S.T.A.L.K.E.R. Anomaly 1.5.2, using LuaLS/lua-language-server.
This provides annotations for the functions, classes, and namespaces for various scripts (listed below).
This also allows the language server to (hopefully) recognise classes in the form of:
class "new_class" (super_class)
In a hacky way, this also loads variables, functions, and classes from other scripts into their own namespace - replicating how the engine loads the Lua scripts. In essence, this should allow autocomplete and Go To Definition commands to work on variables referenced from library scripts.
- Install Visual Studio Code
- Install the lua-language-server extension
- Clone this repository (e.g.
git clone https://github.com/Aoldri/anomaly-definitions.git
) - Apply Environment Emulation with this repository
In user settings, add the root folder containing this repository to Lua > Workspace: User Third Party
.
If you're working in a single folder workspace, you can apply the 'Environment Emulation" when prompted to "configure your work environment as Stalker: Anomaly".
If you're working in a multi-folder workspace, the above instructions will only apply to a single folder (for unknown reasons). As such, the following steps are recommended.
Add the following settings:
// <workspace>.code-workspace
// settings.json
{
"files.associations": {
"*.script": "lua"
},
"Lua.workspace.library": [
"<repo>/library"
],
"Lua.workspace.ignoreSubmodules": false,
"Lua.diagnostics.disable": [
"lowercase-global"
],
"Lua.runtime.plugin": "<repo>/plugin.lua",
"Lua.runtime.version": "Lua 5.1",
}
I also recommend adding external scripts to Lua.workspace.library
for autocomplete, such as unpacked/gamedata/scripts
, or other utility scripts written by modders.
Exhaustive list:
lua_help.script
_g.script
db.script
ui_mcm.script
Expanding coverage to include other .script
files will come with time, because they need to be hardcoded in a file somewhere.