Hello, Lua
Lua is a small, fast scripting language. You will find it inside games (Roblox, World of Warcraft add-ons), text editors, network equipment and countless devices, because it is tiny and easy to embed.
Printing works like this:
print("Mhoro, world!")
print(2 + 3) -- 5
Text after -- is a comment, ignored by Lua.
Variables
local name = "Rudo"
local score = 10
score = score + 5
print(name, score) -- Rudo 15
local creates a variable that belongs to the current block. Always use local unless you really need a global: it avoids accidentally sharing names across your program.
print with several values separates them with a tab. To join text yourself, use .. (two dots):
print(name .. " scored " .. score) -- Rudo scored 15
Lua turns the number into text for you when you join it with ...
Your task
- Print
Hello from Lua!. - Create
playerwith the value"Tariro"andliveswith the value3. - Print
Tariro has 3 livesusing..and your variables.