Menu
CoddyTech

Run Luau Modules

Lesson 1 of 48 in Coddy's Luau for PHP Developers course.

You already know PHP functions, arrays and classes. Luau uses reference tables and closures with gradual static types and different truth rules. This course teaches general programming, not Roblox APIs. Run the supplied two-file program now.

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 PHP Developers

Practice on your own: Online Luau compiler