Write & run Lua
Edit a bundled example or your own Lua and see the UI render in the preview.
MILIUI PLAYGROUND / GUIDE
Build and test Miliastra UI Lua in your browser. You can write a script, open an existing project, import controls from the Miliastra editor, or use the visual Builder.
Edit a bundled example or your own Lua and see the UI render in the preview.
Bring a folder of Lua modules and choose the script that starts the page.
Add MiliUI components, adjust their properties, and export the generated Lua.
QUICK START
You can start without any project files. Use the built-in Quick Start example.
ORIENTATION
Switch between Script and Builder, choose an example, or open Lua files. You can also turn MiliUI on or off. Use Runtime file to load a local version of MiliUI.
Write or edit Lua here. Use Run to preview it, or turn on Auto preview. The Console below shows messages and errors. Save downloads the open file.
The preview shows your UI. Use Viewport to change the test resolution, and View to zoom. Turn on Inspect to select a control instead of clicking it.
Hierarchy and Inspector show your controls and their properties. Diagnostics and Debugger help find problems. Use Parameters to set script parameters, Templates to import UI from the editor, and Signals to test signals and variables.
EXISTING PROJECTS
Use Workspace when your project has multiple Lua files, including files loaded with require(). For a single script, use Files.
OnStart() should run.require().MyProject/
├── UI Controllers/
│ └── Main UI.lua
├── Game UI/
│ ├── Inventory Page.lua
│ └── Inventory Data.lua
└── MiliUI/
└── init.luaIf your project contains MiliUI/init.lua, enable Use folder MiliUI to test that version instead of the published one.
NO-CODE WORKFLOW
LAYOUT TESTING
Viewport sets the resolution your Lua script sees. This is different from the size of the preview panel on your screen.
The default is 1600×900. Try a tablet, portrait, or another resolution to see how your UI adapts. Changing the viewport reruns your script.
Use View to fit or zoom the preview. Zooming and panning only change what you see in the browser, not the resolution used by Lua.
When comparing screenshots with Test Play, use the same canvas size reported by game.GetUICanvasSize(). Two screens can both be 16:9 and still produce different layouts.
EDITOR ASSETS
If you built your UI in the Miliastra editor, you can import its .gia file into the Playground. You don't need to use MiliUI for this.
.gia file in Miliastra. In the Playground, open Script → Preview tools → Templates and choose Import .gia.game.InstantiateClientUIControl(), then click Run. Check Hierarchy or use Inspect to see the imported controls..gia. IDs may change between exports. The Playground may also ask you to re-import after an importer update.function OnStart()
local menu = game.InstantiateClientUIControl(
1073742342,
script.object
)
menu:SetActive(true)
menu:SetVisible(true)
end.gia files have a Server template around the Client root. Both may appear in the Playground, but client UI Lua normally uses the Client root ID. A Server template that previews in the browser might not work with game.InstantiateClientUIControl() in Test Play. The ID in this example comes from one export.STATE AND EVENTS
The Playground doesn't run your game's server scripts. You can use the Signals tab to test what your client UI does when it receives a server signal or a custom variable update.
Run a script with a script:RegisterServerSignalHandler() listener. In Signals, select the signal name or enter it yourself, add any parameters, and click Send. The handler runs without restarting the page.
Choose Player, Stage, or Character. Enter the variable name, type, and value, then click Apply Change. Your script can read the value with game.GetGlobalCustomVariableValue(), and registered change handlers run.
local function refreshClass()
local currentClass = game.GetGlobalCustomVariableValue(
Enum.CustomVariableEntityType.PlayerSelf,
"Current Class"
) or "None"
print("Current Class: " .. currentClass)
end
function OnStart()
script:RegisterCustomVariableChangedHandler(
Enum.CustomVariableEntityType.PlayerSelf,
"Current Class",
refreshClass
)
refreshClass()
endTo try it, set the entity to Player, the name to Current Class, the type to String, and the value to Warrior. Click Apply Change and check the Console. Reapplying the same value also calls the handler. If a script registers more than one handler for the same entity and variable, only the first one runs.
You can use String, Integer, Float, Boolean, List, Dictionary, and Struct values. For List, Dictionary, and Struct, enter JSON such as ["Warrior","Tank"] or {"health":100}. Lua receives these as tables. JSON null isn't supported. Values remain set when you click Run, but they are cleared when you reload the browser page.
TROUBLESHOOTING
Check the Console for errors. Make sure the selected Preview script has OnStart(). If the script uses MiliUI, check that MiliUI is enabled and loaded.
Open Parameters in the preview tools. You can enter values for script:GetParam("...") and choose UI template IDs and control types. Missing values also appear in Diagnostics.
Turn on Inspect, select the control, and check its properties. Use Hierarchy, Diagnostics, or Show bounds to check its size and position.
Check the Console for errors. Use Signals to test listeners. If your UI reads a server-owned variable, change it separately in Custom Variables. The Debugger can help track which code ran.
QUESTIONS
No. The Playground runs supported plain Miliastra client UI Lua. Keep MiliUI enabled when your scripts import MiliUI components or layout features; disable it to test raw client UI code without the library.
No. In a workspace, selecting a file changes the editor. The separate Preview selector determines which runnable entry script starts the UI. You can also use the play control beside a runnable file.
Open Templates and expand the imported file. Use the ID marked Client root and Template ID. If you exported the file again, check the ID and re-import it. IDs from older exports may no longer match.
Check the canvas resolution first, then check whether the same fonts and assets are available. Some game features aren't reproduced exactly in the browser. Use Test Play as the final check.
No. Changes you make in the browser aren't necessarily saved to your original files. Use Save in Script mode or Export in Builder mode to keep a copy.
Start with Quick Start, then open your own Lua workspace or switch to Builder Mode.
Go to Playground