Current LUA libraries are always included in latest CSP version. Here is some documentation that could help to start scripting.
- Built-in apps;
- Apps from App Shelf;
- Built-in internal scripts;
- Built-in postprocessing filters;
- Default WeatherFX implementation;
- Paintshop app;
- Various Lua examples.
Whole API is fully documented, documentation definitions are shipped with CSP builds and can be found in “extension/internal/lua-sdk” folder, with a readme file on how to plug them in. You’d need to use Visual Studio Code and Lua plugin by sumneko, and it would result in a neat seamless docs integration:
Definition files are generated in EmmyLua format, and there are plugins for other IDEs too, but it might be a bit more tricky to set.
More information is available in wiki.
Any Lua script in Assetto Corsa first loads ac_common library and then loads a library corresponding to its type.
Different types of script can define different script.…
functions which will then be called by CSP when certain event occurs.
For backwards compatibility some functions, like function script.update()
, can be defined in global namespace like function update()
,
but script.…
ones will be looked for first. Once CSP finds a function, it would store a reference to it for faster lookup when calling
in the future, so changing functions on-fly wouldn’t work.
This repository contains source code for standard CSP Lua libraries. Feel free to use any of its parts, like its class implementation, in your projects, or just use it for a reference when writing Lua scripts for Assetto Corsa.
Designed to work with OpenResty’s fork of LuaJIT compiled with 5.2 compatibility option and a few tweaks applied to better suit Assetto Corsa.