πŸŽ“ A1Learner
πŸ”
0 of 49 lessons completed

Lua Advanced Introduction

The Lua Advanced level is the expert level of Lua. It assumes the intermediate level is complete and builds deeper control over how a program runs.

Expert code is still plain Lua

A short program still runs the same way. Its result is one number the reader can check.

local total = 0
for i = 1, 3 do
  total = total + i * i
end
print(total)

Experts predict exact output

The largest of the two numbers is the only output. There is nothing else to guess.

print(math.max(12, 30))

Tables hold related values

Three values sit in one table. Adding them gives one checked total.

local scores = {10, 20, 30}
print(scores[1] + scores[2] + scores[3])

Example

print("Lua" .. " " .. "Advanced")

Key points

  • Assumed knowledge: intermediate Lua is taken as known.
  • Expert focus: control over how code runs and how values are found.
  • New depth: small details of Lua now change program behavior.
  • Reading skill: an expert reads a short program and predicts its exact output.
  • Writing skill: an expert writes short programs whose output can be checked.

In this example, the two words join with .. and a space, and print shows the joined result.

Note

advanced code stays plain Lua and uses the same interpreter as earlier levels.

Try it Yourself

Edit the code, then press Run.

Running is simulated

Exercise

What does the Lua Advanced level assume?