Menu
CoddyTech

Print and Comment

Lesson 2 of 48 in Coddy's Luau for C# Developers course.

C# Console.WriteLine supports interpolation and overloads. Luau print converts values and inserts tabs between arguments. Join one string with .. or string.format when exact spacing matters. Luau chunks execute directly without a class or entry-point declaration, and line comments begin with --.

C# comparison

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
Console.WriteLine("Hi" + ", Ada");

Luau behavior

Luau keeps print and -- comments. Concatenation uses .., while backtick strings interpolate expressions in braces. Construct one string when the output contract specifies spacing; print with multiple arguments inserts separators.

local name = "Ada"
print(`Hi, {name}`)

Expected Luau output:

Hi, Ada
challenge icon

Challenge

Easy

Return Hello, followed by the first input line exactly, or an empty name when input is absent. Spaces and punctuation are significant.

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))
quiz iconTest yourself

This lesson includes a short quiz. Start the lesson to answer it and track your progress.

All lessons in Luau for C# Developers

Practice on your own: Online Luau compiler