MMiliUI Playground
Getting started Open Playground

MILIUI PLAYGROUND / GUIDE

Getting started

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.

01 / SCRIPT

Write & run Lua

Edit a bundled example or your own Lua and see the UI render in the preview.

02 / WORKSPACE

Open real projects

Bring a folder of Lua modules and choose the script that starts the page.

03 / BUILDER

Build visually

Add MiliUI components, adjust their properties, and export the generated Lua.

01

QUICK START

Run your first preview

You can start without any project files. Use the built-in Quick Start example.

  1. Open the Playground and wait for the Lua editor to load.
  2. In Script mode, choose Quick Start from the Example menu.
  3. Click Run above the editor. The UI appears on the right. You can enable Auto preview to rerun the script as you edit it.
  4. Try clicking the UI. Change the Lua and run it again. The Console below the editor shows printed messages and errors.
The Playground simulates the Miliastra client UI Lua runtime. MiliUI is an optional UI library that is enabled by default. You can turn it off when testing regular client UI Lua.
02

ORIENTATION

Know the interface

Top bar

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.

Left pane: Lua editor

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.

Right pane: Preview

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.

Preview tools

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.

03

EXISTING PROJECTS

Open a Lua workspace

Use Workspace when your project has multiple Lua files, including files loaded with require(). For a single script, use Files.

  1. Click Workspace and select your Lua project folder. The folder can have any name.
  2. Click a file in the tree to edit it. Use the separate Preview selector to choose which script's OnStart() should run.
  3. Click Run. The Playground loads any local modules referenced through require().
  4. If you change files in another editor, click Refresh. Where supported, Auto refresh can pick up those changes for you.
EXAMPLE FOLDER
MyProject/
├── UI Controllers/
│   └── Main UI.lua
├── Game UI/
│   ├── Inventory Page.lua
│   └── Inventory Data.lua
└── MiliUI/
    └── init.lua

If your project contains MiliUI/init.lua, enable Use folder MiliUI to test that version instead of the published one.

Chrome and Edge can usually refresh a folder without asking you to select it again. Other browsers may require you to reopen the folder to load recent changes. Save any unsaved edits before refreshing files from disk.
04

NO-CODE WORKFLOW

Build a page visually

  1. Switch to Builder in the top bar and start a Blank or Settings Page template.
  2. Use Components to insert a Row, Column, Text, Button, Card, or other available component.
  3. Use Hierarchy to select, move, duplicate, or remove components. You can insert a component inside a container or before or after another component.
  4. In Properties, change the text, size, layout, or alignment. Use flexible sizes if your UI needs to work on different screens.
  5. Open Code to view the generated Lua. You can copy it, export it, or open it in Script mode.
Builder uses the same preview as Script mode and generates regular MiliUI Lua. Builder projects are stored in your browser. Export the Lua if you want a copy outside the browser.
05

LAYOUT TESTING

Test multiple screen sizes

Viewport sets the resolution your Lua script sees. This is different from the size of the preview panel on your screen.

Change the canvas size

The default is 1600×900. Try a tablet, portrait, or another resolution to see how your UI adapts. Changing the viewport reruns your script.

Zoom without changing the resolution

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.

06

EDITOR ASSETS

Preview UI exported from Miliastra

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.

  1. Export your UI as a .gia file in Miliastra. In the Playground, open Script → Preview tools → Templates and choose Import .gia.
  2. Expand the file in the Templates panel. Find the Client root marked Template ID. You can expand controls to see their children and IDs.
  3. Use that ID with game.InstantiateClientUIControl(), then click Run. Check Hierarchy or use Inspect to see the imported controls.
  4. If you export the UI again, re-import the new .gia. IDs may change between exports. The Playground may also ask you to re-import after an importer update.
Lua example: replace the ID with your Client root ID
function OnStart()
    local menu = game.InstantiateClientUIControl(
        1073742342,
        script.object
    )

    menu:SetActive(true)
    menu:SetVisible(true)
end
Some .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.
07

STATE AND EVENTS

Test signals and custom variables

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.

Server Signals

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.

Custom Variables

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.

Lua example: read a player variable when it changes
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()
end

To 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.

Sending a server signal in the Playground does not run your server script or change a custom variable automatically. To test a server-owned value changing, use Apply Change separately. Test the full server-to-client flow in Miliastra Test Play.
08

TROUBLESHOOTING

Find and fix problems

The preview is blank

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.

A script parameter is missing

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.

Something is misplaced

Turn on Inspect, select the control, and check its properties. Use Hierarchy, Diagnostics, or Show bounds to check its size and position.

A button or callback doesn't work

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.

The Playground is a browser preview, so some game behavior may differ. Check interactions, animation assets, and controller support in Miliastra Test Play before releasing your UI.
09

QUESTIONS

Frequently asked questions

Do I need MiliUI to use the Playground?

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.

Does choosing a file also change which script runs?

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.

Why is my imported control missing?

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.

Why does my game look different from the browser preview?

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.

Is my work automatically saved to my files?

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.

Ready to try it?

Start with Quick Start, then open your own Lua workspace or switch to Builder Mode.

Go to Playground