Skip to content

ac-custom-shaders-patch/acc-lua-sdk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Writing your own Lua scripts for Assetto Corsa

First, check this out

Current LUA libraries are always included in latest CSP version. Here is some documentation that could help to start scripting.

Also, here are some scripts to use as examples

How to start writing scripts

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:

Screenshot

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.

How libraries work

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: standard CSP Lua library

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.

About

Source code for CSP Lua libraries

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published