The script shape in Lua
The smallest Lua: locals, print, and string.format.
-- A script runs top to bottom; print writes a line.
local dungeon = "The Sunken Crypt"
local floors = 5
print("Now entering " .. dungeon)
print("Floors to clear:", floors)
print(string.format("Rooms if all full: %d", floors * 8))
How it works
- A script runs top to bottom; no main function exists.
..concatenates;printtakes several arguments with tabs.string.formatdoes the printf work with %d and %s.
Keywords and builtins used here
localprint
The run, in numbers
- Lines
- 7
- Characters to type
- 231
- Tokens
- 39
- Three-star pace
- 75 tpm
At the three-star pace of 75 tokens a minute, this run takes about 31 seconds.
Step 1 of 3 in Values, step 1 of 27 in Language basics.