csp-lua
БесплатноБез исполняемых скриптовНе проверенCSP (Custom Shaders Patch) Lua API reference and workflow for Assetto Corsa modding. Use when writing, reviewing, debugging, or testing CSP Lua code…
Об этом скилле
CSP Lua
Use this skill for Assetto Corsa Custom Shaders Patch Lua work. Prefer local bundled references first; they match the installed SDK snapshot better than memory or web snippets.
Workflow
- Read the repo instructions first when working inside a project, especially
AGENTS.mdorCLAUDE.md. - Search the local API before inventing names:
.\.claude\skills\csp-lua\scripts\find-api.ps1 "ac.getCar" .\.claude\skills\csp-lua\scripts\find-api.ps1 "function ui.slider" rg -n "StateCar|splinePosition|trackLengthM" .\.claude\skills\csp-lua\reference\lib.lua - Prefer the smaller SDK source files when you know the namespace:
reference/sdk/common/ac_state.lua: car/sim/session state.reference/sdk/common/ac_ui.lua:ui.*, windows, settings, controls.reference/sdk/common/ac_storage.luaand.d.lua: persistent storage.reference/sdk/common/io.luaand.d.lua: CSP file APIs.reference/sdk/common/ac_render.lua:render.*drawing callbacks.reference/sdk/common/ac_physics*.lua:physics.*, AI, reset, car control.reference/sdk/common/ac_web*.luaandlib_web.lua: HTTP/web APIs.reference/sdk/common/ac_audio*.lua: audio events.reference/lib.lua: generated complete EmmyLua API, enums, classes, overloads.
- Implement with immediate-mode CSP patterns, then run local Lua tests or syntax checks where available.
- If debugging in-game behavior, inspect filtered CSP logs:
.\.claude\skills\csp-lua\scripts\logs.ps1 -l 80 -only ERROR .\.claude\skills\csp-lua\scripts\logs.ps1 -l 120
Non-Negotiables
- Do not put shell execution in CSP runtime code. Avoid
io.popen,os.execute,start,cmd, PowerShell, and external CLI calls from Lua. Use CSP APIs such asio.open,io.save,io.load,io.scanDir,io.createDir,web.*,ac.*, andphysics.*. - Do not guess API names. Search
reference/lib.luaorreference/sdk/**before using unfamiliar CSP APIs. - Keep runtime work small in
script.update(dt)and UI draw callbacks. Expensive parsing, scans, and bulk serialization should be throttled, cached, or moved out of per-frame paths. - Use
script.*callbacks, not legacy global callbacks, unless maintaining old code. CSP looks up and caches callback functions. - Treat AC/CSP code as LuaJIT 2.1 with Lua 5.1 behavior plus CSP extensions, not stock Lua 5.4.
App Structure
Lua apps live in assettocorsa/apps/lua/<app-id>/ with a manifest.ini and <app-id>.lua entry file. The official CSP Lua app wiki describes app folders, manifest.ini, lazy loading, window callbacks, UI callbacks, render callbacks, and script.update(dt).
Typical manifest window:
[ABOUT]
NAME = My App
AUTHOR = ...
VERSION = 1.0
DESCRIPTION = ...
[CORE]
LAZY = PARTIAL
[WINDOW_MAIN]
ID = main
NAME = My App
FUNCTION_MAIN = windowMain
FUNCTION_SETTINGS = windowSettings
SIZE = 400, 240
FLAGS = SETTINGS
Typical entry file:
local state = { clicks = 0 }
function script.update(dt)
local car = ac.getCar(0)
if not car then return end
end
function script.windowMain(dt)
if ui.button('Click') then
state.clicks = state.clicks + 1
end
ui.text('Clicks: ' .. state.clicks)
end
script.update(dt) runs every frame even when app windows are closed, depending on app laziness. Window functions run only when their windows are visible. UI_CALLBACKS draw outside app windows and need an explicit ui.transparentWindow() or ui.toolWindow().
Core State APIs
Use ac.getSim() for global simulation state:
sim.dt: simulation delta in seconds; can be0while paused.sim.time: total AC time in milliseconds.sim.gameTime: total AC time in seconds.sim.trackLengthM: track length in meters.sim.isPaused,sim.isOnlineRace,sim.currentSessionIndex,sim.sessionTimeLeft.sim.rainIntensity,sim.roadGrip,sim.connectedCars.
Use ac.getCar(index) for car state; index 0 is the player:
car.speedKmh,car.splinePosition,car.lapCount,car.lapTimeMs,car.bestLapTimeMs.car.gas,car.brake,car.clutch,car.steer,car.gear,car.handbrake.car.isLapValid,car.resetCounter,car.lastLapCutsCount,car.collisionDepth,car.isInPitlane.car.racePosition,car.fuel, tyre/wheel fields, contact/slip fields; searchStateCarfor the full list.
Track and car helpers:
local trackId = ac.getTrackID() -- preferred spelling
local carId = ac.getCarID(0)
local carName = ac.getCarName(0, true)
local meters = ac.getSim().trackLengthM or 0
local world = ac.trackProgressToWorldCoordinate(0.25)
local progress = ac.worldCoordinateToTrackProgress(world)
local sectorName = ac.getTrackSectorName(0.25)
ac.getSim().trackId is not a valid substitute for ac.getTrackID().
Files And Storage
Use CSP io.* APIs in runtime code:
io.createDir(path)
local f = io.open(path, 'w')
if f then
f:write(data)
f:close()
end
l
Установить csp-lua в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл csp-lua?
CSP (Custom Shaders Patch) Lua API reference and workflow for Assetto Corsa modding. Use when writing, reviewing, debugging, or testing CSP Lua code, including Assetto Corsa Lua apps, ac.*, ui.*, render.*, physics.*, io.*, web.*, storage, app windows, telemetry, track/car state, memory-mapped files, LuaJIT/FFI, and AC Tracer-specific CSP integration.
Как установить скилл csp-lua?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл csp-lua запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
doc-coauthoring
Guide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision…
от Anthropicacademy-guide
Stop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials…
от Anthropicinternal-comms
A set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill…
от Anthropicskill-development
This skill should be used when the user wants to "create a skill", "add a skill to plugin", "write a new skill", "improve skill description", "organize skill…
от Anthropic