https://github.com/flying-dice/dcs-hot-loader
Load and execute LUA files in DCS at runtime
https://github.com/flying-dice/dcs-hot-loader
dcs dcs-world modding
Last synced: about 1 year ago
JSON representation
Load and execute LUA files in DCS at runtime
- Host: GitHub
- URL: https://github.com/flying-dice/dcs-hot-loader
- Owner: flying-dice
- Created: 2024-01-11T21:32:21.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2025-03-11T12:10:59.000Z (over 1 year ago)
- Last Synced: 2025-03-29T00:51:16.983Z (over 1 year ago)
- Topics: dcs, dcs-world, modding
- Language: TypeScript
- Homepage:
- Size: 289 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
Awesome Lists containing this project
README
[](https://discord.gg/bT7BEHn5RD)
[](https://discord.com/channels/738118932937834566/1178991295260278785)
[](https://chat.openai.com/g/g-6643nUbup-tslua-dcs-codebot)
[](https://patreon.com/flyingdice)

DCS Hot Loader is a tool to allow for hot loading of lua scripts in DCS World.
It exposes a REST API to allow for the execution of lua scripts.
## Installation
All that is required is to copy the `dcs-hot-loader.lua` into the `Scripts/Hooks` folder in your DCS Saved Games folder.
[](https://dcs-dropzone-registry-viewer.pages.dev/#/hot-loader)
### Open Beta
```
%USERPROFILE%\Saved Games\DCS.openbeta\Scripts\Hooks\
```
### Stable
```
%USERPROFILE%\Saved Games\DCS\Scripts\Hooks\
```
## Usage
> To run the below tests, create a file called `hello-world.lua` in your `DCS\Scripts` folder with the following contents
>
> ```lua
> -- C:\Users\username\Saved Games\DCS.openbeta\Scripts\hello-world.lua
> if (log and log.info) then
> log.info("Hello World!")
> else
> print("Hello World!")
> end
> ```
The server will automatically start when you start DCS World.
To use the server, make a request to the following endpoint
```shell
curl --location 'http://127.0.0.1:7943/dofile' \
--header 'Content-Type: application/json' \
--data '{
"path": "{WRITE_DIR}\\Scripts\\hello-world.lua",
"target": "gui"
}'
```
### Target
The target parameter should be one of the following
- `gui` (GameGUI)
- `mission` (Mission Scripting Environment)
### Variables
The following variables are available for path replacements, ofc you can also use absolute paths
| Key | Function | Example |
| ----------- | ------------------ | --------------------------------------------------------- |
| WRITE_DIR | `lfs.writedir()` | `C:\\Users\\jonat\\Saved Games\\DCS.openbeta\\` |
| INSTALL_DIR | `lfs.currentdir()` | `D:\\Program Files\\Eagle Dynamics\\DCS World OpenBeta\\` |
| TEMP_DIR | `lfs.tempdir()` | `C:\\Users\\jonat\\AppData\\Local\\Temp\\DCS.openbeta\\` |
To get an active list of variables, make a request to the following endpoint
```shell
curl --location 'http://127.0.0.1:7943/health'
```
### Response
Once executed the response will be the resolved URL or any errors
> **Note:** When using the `mission` target, the response may not indicate errors with resolving the path, but you will receive an alert in mission
```json
{
"status": "OK",
"path": "C:/Users/username/Saved Games/DCS.openbeta//Scripts/hello-world.lua",
"target": "gui"
}
```