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 |
| GLSL shaders | Edit forked shader sources (.vert/.frag/.glsl); saving recompiles and refreshes the viewport. See Custom Shaders |
| 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¶
- Select an entity and click New Script at the bottom of the Properties window.
- Choose Lua Script, C++ Subclass, or C++ Script Class.
- Enter the class/module name and confirm.
The editor generates the files from templates, attaches a ScriptComponent entry to
the entity, and opens the new files here in the Code Editor. To link existing files
instead, add an empty entry with Add Script inside the ScriptComponent and pick the
files in its edit dialog — see
Creating Scripts.

Drag entities into your code¶
Drag an entity from the Structure panel onto a script open in the Code Editor to create an entity reference property:
- Lua file — a typed entry is appended to the
propertiestable. - C++ header — a
DPROPERTYline and pointer member are inserted (with the#includewhen the type is another script class). Dropping on a.cppshows a reminder to use the header.
The property type comes from the dropped entity (its script class, or wrapper type such
as Object/Mesh/Camera), and the entity is assigned as the property value
automatically. See
Script Properties.
Script entry point¶
Scripts subscribe to the engine events they need (onUpdate, onFixedUpdate,
onPause, onResume, onShutdown, and the input events). Lua scripts register in
init(); C++ scripts register in the constructor and unregister in the destructor:
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.