Code Editor¶
The integrated code editor lets you write and edit Lua and C++ scripts without leaving the Doriax editor. It provides syntax highlighting, API completion, script creation dialogs, and a live output panel for compile and export messages.

Supported workflows¶
| Workflow | Notes |
|---|---|
| Lua scripts | Fast iteration — script-only changes take effect immediately in play mode without rebuilding |
| C++ scripts | Compiled at export/build time for native performance; require a rebuild to take effect |
| Script templates | Create new Lua or C++ script files from boilerplate using the New Script dialog |
| API completion | Engine API suggestions generated from Lua bindings; covers classes, methods, and constants |
| Build output | Compiler errors, warnings, and export messages stream into the Output panel |
Creating a new script¶
- Open the New Script dialog from the toolbar or the Code Editor menu.
- Choose Lua or C++.
- Enter the class name — the editor generates a file with the correct
ScriptBasesubclass structure. - Save to the
scripts/folder. - Return to the scene, select an entity, and add a
ScriptComponentin the Properties window. - Assign the new script file and enable the entry.

Script entry point¶
Every script receives engine lifecycle callbacks. Implement only the callbacks you need:
See Creating Scripts for the full lifecycle and event system documentation.
DPROPERTY and script properties¶
Properties declared with DPROPERTY (C++) or in the properties table (Lua) appear
as editable fields in the Properties window automatically.

The editor parser reads DPROPERTY from C++ headers and populates the Properties
window without requiring a build. See
Script Properties for syntax and type mapping details.
Project entry points¶
A project can have both Lua and C++ startup paths. Set which one is active in project
settings, or keep both and use NO_CPP_INIT / NO_LUA_INIT to disable one at
compile time.
Practical tips¶
- Keep startup code small — move gameplay behavior into scripts or systems.
- Use
DPROPERTYfor values that designers should tune; avoid hard-coding magic numbers inside script logic. - Watch the Output panel after every C++ edit or export; it shows the first compiler error clearly.
- Lua scripts iterate faster during development — prototype in Lua, port to C++ for performance-critical paths.
- Use the built-in Log API for runtime diagnostics
rather than relying on
print.