> For the complete documentation index, see [llms.txt](https://docs.lostdev.store/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.lostdev.store/races/integrations.md).

# Integrations

No hard dependency on any XP, mission, or skill system is required. Instead, use the exports and events below to connect LD Races to your other resources without editing its code.

## Exports

```lua
exports.ld_races:GetLoadedRaces()
```

Returns the server-side race cache (every currently loaded route and its config). Useful for building your own map/menu integrations, or for other resources that want to know what routes exist.

```lua
exports.ld_races:ReloadRaces()
```

Reloads routes from `Config.Routes` + the database. Equivalent to running `/race_reload`, but callable from code (e.g. after another resource inserts a row into `ld_races_routes` directly).

## Events

```lua
AddEventHandler('ld_races:raceFinished', function(source, payload)
    -- payload includes raceKey, mode, position, timeMs, status (finished/dnf/dq), reward, etc.
end)
```

Fires for **every** finished, DNF'd, or disqualified run — hook this to log races into your own systems, trigger achievements, update a scoreboard resource, etc.

```lua
AddEventHandler('ld_races:playerGainedXp', function(source, xp, reason)
end)
```

Fires whenever a reward includes XP. Hook this into your own leveling/skill system — LD Races itself has no opinion on what XP does; it just reports when it was earned and how much.

## `ld_tablet` integration

If `ld_tablet` is running and `Config.UI.useSharedTablet = true`, LD Races registers itself as an app inside that shared tablet UI instead of (or in addition to) its own standalone menu.

This is automatic — no extra configuration needed beyond having `ld_tablet` started before `ld_races`.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.lostdev.store/races/integrations.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
