Menu
CoddyTech

Run a Luau Module

Lesson 1 of 35 in Coddy's Luau for Lua Developers course.

This shorter bridge assumes Lua fundamentals. Shared truth rules, table identity, byte strings and metatables remain relevant; the tasks exercise them while the reading focuses on what Luau adds or changes. No Roblox API or scene lifecycle is involved.

The editable app.luau returns a module table. The locked main.luau loads it using require("./app"), reads input and prints its result. Coddy supplies io.lines and io.read through a patched CLI; upstream Luau does not provide this stdin library. Do not assume filesystem access.

The runner uses the pinned Luau 0.731 build. It runs luau-compile --null for syntax and then executes the program. It does not run luau-analyze. Annotations describe intended types; runtime guards and behavior tests enforce these tasks. Supplementary local analyzer checks are separate evidence.

challenge icon

Challenge

Beginner

Run the supplied program. No edits or input are required. It returns Luau is ready.

Edit app.luau. The visible locked main.luau reads stdin into a sequence of lines, calls app.run(lines), and prints its returned value with one final newline. Do not print diagnostics or change the module names. Empty input gives an empty sequence. All numeric inputs are small enough to avoid overflow.

Try it yourself

local app = require("./app")
local lines = {}
for line in io.lines() do lines[#lines + 1] = line end
print(app.run(lines))

All lessons in Luau for Lua Developers

Practice on your own: Online Luau compiler