> For the complete documentation index, see [llms.txt](https://docs.settlers-united.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.settlers-united.com/s4-lua-api-de/tutorials/advanced-tipps/moderner-lua-compiler.md).

# Moderner Lua Compiler

Da es für diese [alte S4 Lua Version](https://www.lua.org/manual/3.2/manual.html) keine Binärdateien gibt, hat sich MuffinMario die Mühe gemacht dies in einen modernen Compiler zu packen. Dies ist ein x86/x64 Standalone Lua 3.2.1 (Version in Siedler IV) Interpreter. \
Über die CMD könnt ihr so eure geschriebenen Scripte überprüfen und findet ggf. entsprechende Fehler die das Script brechen würden. Sobald es im Script einen Syntaxfehler gibt, läd Siedler4 das komplette Script nicht - jedoch bekommt ihr keine entsprechende Fehlermeldung. \
Um also euer Script auf Syntaxfehler zu überprüfen, geht am besten wie folgt vor:

* Legt den Compiler im selben Ordner wie euer Script ab. (Ihr müsst also das Script in einer externen Datei haben!)
* Öffnet die Kommandozeile ( **\[Win] + \[R]** und gebt dort "cmd" ein) und geht in das Verzeichnis eures Scripts und des Compilers. (Ordner wechseln macht ihr mit dem Befehle "cd")
* Führt nun mithilfe der Exe euer Script aus:\
  `luai.exe dateiname.lua`<br>

**Weitere Beispiele zur Ausführung in der Kommandozeile**

Zum schreiben in die Konsole:\
`luai`\
\
Ausführen einer Datei:\
`luai dateiname.lua`\
\
Interaktiver Modus in der Kommandozeile (Zum Beenden Strg+C):\
`luai -q (ohne dem > vor jeder eingegebenen Zeile)`\
`luai -i`\
\
Konsoleneingaben bis zum Beenden mit Strg+C als ein Skript gelesen bekommen:\
`luai -`

{% file src="/files/Px6LjZEZDktecAzX3p5I" %}


---

# 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.settlers-united.com/s4-lua-api-de/tutorials/advanced-tipps/moderner-lua-compiler.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.
