Skip to content

Search documentation

Enter at least two characters.

    Your first advanced project

    SDK 0.1.0-preview.1 · ExperimentalDownload & release notes ↗

    Build a small project library with Home and Library screens. Reuse a button component, preserve a counter and selection while switching screens, and package the result.

    Complete your first project first. This walkthrough uses local example data and the same Windows SDK. It does not need network access or a storage provider. State lasts for the current app session; restarting starts fresh.

    Create a new project named ProjectLibrary. Each chapter has a complete downloadable checkpoint. Extract checkpoints to new folders and open the extracted project folder containing lui.json; do not paste one project’s pin or manifest into an unrelated project.

    Start with a window and a content container. Replace Src/Main.luau:

    local Window = Instance.new("Window", { Title = "LUI project library", Size = UDim2.fromOffset(760, 560) })
    local Content = Instance.new("Frame", { Parent = Window, Position = UDim2.fromOffset(16, 88), Size = UDim2.new(1, -32, 1, -100) })
    Instance.new("TextLabel", { Parent = Content, Text = "My project library" })
    Window.Visible = true

    The content leaves room for navigation above it. UDim2.new(1, -32, 1, -100) combines parent-relative scale with logical offsets. It does not mean physical display pixels.

    Check and run: you should see My project library. Download chapter 1.

    Create Src/Screens/Home.luau and move screen creation into a function:

    return function(Parent: Window): Frame
    local Root = Instance.new("Frame", {
    Parent = Parent,
    Name = "Home",
    Size = UDim2.new(1, -32, 1, -100),
    Position = UDim2.fromOffset(16, 88),
    })
    Instance.new("UIListLayout", { Parent = Root, Padding = UDim.new(0, 12) })
    Instance.new("TextLabel", {
    Parent = Root,
    Text = "My project library",
    Size = UDim2.fromOffset(550, 48),
    })
    return Root
    end

    Update Src/Main.luau to load and call it:

    local Home = require("./Screens/Home")
    local Window = Instance.new("Window", {
    Name = "ProjectLibrary",
    Title = "LUI project library",
    Size = UDim2.fromOffset(760, 560),
    })
    Home(Window)
    Window.Visible = true

    New source files must be declared. Use this complete lui.json for this chapter:

    {
    "SchemaVersion": 2,
    "Script": "Src/Main.luau",
    "Capabilities": [],
    "Extensions": [],
    "Assets": [],
    "ExtensionDeclarations": [],
    "Diagnostics": {
    "Mode": "Development"
    },
    "Modules": {
    "Root": "Src",
    "Files": [
    "Main.luau",
    "Screens/Home.luau"
    ],
    "Requires": [],
    "Dependencies": []
    }
    }

    The module root is Src; Modules.Files lists exact-case paths relative to that root. require("./Screens/Home") is relative to the source containing the call. Modules return one non-nil exported value. They do not download dependencies.

    Check and run: the same screen should appear, now assembled from two files. A missing-source error usually means a filename, case or module declaration differs. Download chapter 2.

    Create Src/Components/Button.luau:

    return function(Parent: Window | Frame, Name: string, Text: string, Callback: () -> ()): TextButton
    local Button = Instance.new("TextButton", {
    Parent = Parent,
    Name = Name,
    Text = Text,
    Size = UDim2.fromOffset(190, 44),
    })
    Button.Activated:Connect(Callback)
    return Button
    end

    The function accepts a parent, name, label and callback, then returns the new button. It keeps repeated setup in one place. Update Src/Screens/Home.luau:

    local Button = require("../Components/Button")
    return function(Parent: Window): Frame
    local Root = Instance.new("Frame", {
    Parent = Parent,
    Name = "Home",
    Size = UDim2.new(1, -32, 1, -100),
    Position = UDim2.fromOffset(16, 88),
    })
    Instance.new("UIListLayout", { Parent = Root, Padding = UDim.new(0, 12) })
    Instance.new("TextLabel", {
    Parent = Root,
    Text = "My project library",
    Size = UDim2.fromOffset(550, 48),
    })
    local Status = Instance.new("TextLabel", {
    Parent = Root,
    Name = "CounterStatus",
    Text = "Ready",
    Size = UDim2.fromOffset(550, 38),
    })
    Button(Root, "Increment", "Add action", function()
    Status.Text = "Action added"
    end)
    return Root
    end

    Add Components/Button.luau to Modules.Files in lui.json. Main.luau stays as it was in chapter 2.

    Check and run: clicking Add action should change the status to Action added. Download chapter 3.

    Add a Library screen in Src/Screens/Library.luau:

    local Button = require("../Components/Button")
    return function(Parent: Window): Frame
    local Root = Instance.new("Frame", {
    Parent = Parent,
    Name = "Library",
    Size = UDim2.new(1, -32, 1, -100),
    Position = UDim2.fromOffset(16, 88),
    })
    Instance.new("UIListLayout", { Parent = Root, Padding = UDim.new(0, 12) })
    Instance.new("TextLabel", {
    Parent = Root,
    Text = "Choose a project",
    Size = UDim2.fromOffset(550, 48),
    })
    local Status = Instance.new("TextLabel", {
    Parent = Root,
    Name = "Selection",
    Text = "Select a project",
    Size = UDim2.fromOffset(550, 38),
    })
    for _, Name in { "Aurora tools", "Map viewer", "Workshop" } do
    Button(Root, "Project_" .. Name, Name, function()
    Status.Text = "Selected: " .. Name
    end)
    end
    return Root
    end

    Replace Src/Main.luau to add navigation:

    local Button = require("./Components/Button")
    local Home = require("./Screens/Home")
    local Library = require("./Screens/Library")
    local Window = Instance.new("Window", {
    Name = "ProjectLibrary",
    Title = "LUI project library",
    Size = UDim2.fromOffset(760, 560),
    })
    local Navigation = Instance.new("Frame", {
    Parent = Window,
    Name = "Navigation",
    Position = UDim2.fromOffset(16, 16),
    Size = UDim2.new(1, -32, 0, 60),
    })
    Instance.new("UIListLayout", {
    Parent = Navigation,
    FillDirection = "Horizontal",
    Padding = UDim.new(0, 12),
    })
    local Current: Frame? = nil
    local function Show(Screen: string)
    if Current then Current:Destroy() end
    Current = if Screen == "Home" then Home(Window) else Library(Window)
    end
    Button(Navigation, "ShowHome", "Home", function() Show("Home") end)
    Button(Navigation, "ShowLibrary", "Library", function() Show("Library") end)
    Show("Home")
    Window.Visible = true

    Add Screens/Library.luau to Modules.Files. Home and the button component are unchanged from chapter 3.

    Show destroys the old screen before creating the next. Destroying its root retires the children and their callbacks; keeping the native toolkit objects yourself is unnecessary.

    Check and run: switch between Home and Library and choose a project. At this stage, leaving a screen resets its local status. Download chapter 4.

    Create Src/State.luau:

    local State = { Count = 0, Selected = "" }
    return State

    Replace Home so it reads and updates that module:

    local State = require("../State")
    local Button = require("../Components/Button")
    return function(Parent: Window): Frame
    local Root = Instance.new("Frame", {
    Parent = Parent,
    Name = "Home",
    Size = UDim2.new(1, -32, 1, -100),
    Position = UDim2.fromOffset(16, 88),
    })
    Instance.new("UIListLayout", { Parent = Root, Padding = UDim.new(0, 12) })
    Instance.new("TextLabel", {
    Parent = Root,
    Text = "My project library",
    Size = UDim2.fromOffset(550, 48),
    })
    local Status = Instance.new("TextLabel", {
    Parent = Root,
    Name = "CounterStatus",
    Text = "Actions: " .. State.Count,
    Size = UDim2.fromOffset(550, 38),
    })
    Button(Root, "Increment", "Add action", function()
    State.Count += 1
    Status.Text = "Actions: " .. State.Count
    end)
    return Root
    end

    Replace Library so it remembers the selection:

    local State = require("../State")
    local Button = require("../Components/Button")
    return function(Parent: Window): Frame
    local Root = Instance.new("Frame", {
    Parent = Parent,
    Name = "Library",
    Size = UDim2.new(1, -32, 1, -100),
    Position = UDim2.fromOffset(16, 88),
    })
    Instance.new("UIListLayout", { Parent = Root, Padding = UDim.new(0, 12) })
    Instance.new("TextLabel", {
    Parent = Root,
    Text = "Choose a project",
    Size = UDim2.fromOffset(550, 48),
    })
    local Status = Instance.new("TextLabel", {
    Parent = Root,
    Name = "Selection",
    Text = if State.Selected == "" then "Select a project" else "Selected: " .. State.Selected,
    Size = UDim2.fromOffset(550, 38),
    })
    for _, Name in { "Aurora tools", "Map viewer", "Workshop" } do
    Button(Root, "Project_" .. Name, Name, function()
    State.Selected = Name
    Status.Text = "Selected: " .. Name
    end)
    end
    return Root
    end

    Use this final Src/Main.luau:

    local State = require("./State")
    local Button = require("./Components/Button")
    local Home = require("./Screens/Home")
    local Library = require("./Screens/Library")
    local Window = Instance.new("Window", {
    Name = "ProjectLibrary",
    Title = "LUI project library",
    Size = UDim2.fromOffset(760, 560),
    })
    local Navigation = Instance.new("Frame", {
    Parent = Window,
    Name = "Navigation",
    Position = UDim2.fromOffset(16, 16),
    Size = UDim2.new(1, -32, 0, 60),
    })
    Instance.new("UIListLayout", {
    Parent = Navigation,
    FillDirection = "Horizontal",
    Padding = UDim.new(0, 12),
    })
    local Current: Frame? = nil
    local function Show(Screen: string)
    if Current then Current:Destroy() end
    Current = if Screen == "Home" then Home(Window) else Library(Window)
    end
    Button(Navigation, "ShowHome", "Home", function() Show("Home") end)
    Button(Navigation, "ShowLibrary", "Library", function() Show("Library") end)
    Show("Home")
    Window.Visible = true

    The complete final manifest is:

    {
    "SchemaVersion": 2,
    "Script": "Src/Main.luau",
    "Capabilities": [],
    "Extensions": [],
    "Assets": [],
    "ExtensionDeclarations": [],
    "Diagnostics": {
    "Mode": "Development"
    },
    "Modules": {
    "Root": "Src",
    "Files": [
    "Components/Button.luau",
    "Main.luau",
    "Screens/Home.luau",
    "Screens/Library.luau",
    "State.luau"
    ],
    "Requires": [],
    "Dependencies": []
    }
    }

    The declared module is cached within the app generation, so both screens see the same state. A restart creates a fresh generation and resets it. This is not saving to disk.

    Check and run: add two actions, switch to Library, select Map viewer, return Home, then return Library. The counter should still show Actions: 2, and the selection should still be Map viewer. Restart the app and confirm both reset. Download chapter 5.

    Run LUI: Check Types. It checks every declared source without executing your application code.

    Use LUI: Inspect Layout to explore the Instance tree and geometry. It starts a separate app generation; it does not attach to the native window you already have open. Changing state in one does not update the other.

    To create an app folder, open a terminal in your project and run the SDK’s CLI. Use its full path if you have not added it to PATH:

    Terminal window
    & "C:/Tools/LUI/SDK-Preview/lui.cmd" build --output Dist/ProjectLibrary

    Replace the example SDK path with your actual installation. Choose a new output directory. Give recipients the whole Dist/ProjectLibrary folder and launch Start-LUI.cmd; do not send only the executable. This is folder packaging, not a signed installer or updater. Try it on a separate PC before sharing more widely.

    Download the complete project library.

    The walkthrough builds on LUI’s existing modular workspace example. Persistence, networking and application-authored automated test commands are separate topics, not hidden requirements of this project.