Wun Code
Lua

Lua Basics

Lua is a small, fast language for writing game scripts, and you'll find it built into Roblox, FiveM and LÖVE.

Start the trackFree, no sign-up needed

What you'll learn

  • Your first scriptThe local keyword, print and the .. operator for joining strings
  • Numbers and stringsThe //, % and ^ operators and string functions
  • ConditionalsOnly nil and false count as false
  • LoopsLooping with for, while and repeat, and leaving with break
  • Functions and multiple return valuesReturning several values with return and defaults with or
  • Any number of argumentsThe three dots ..., select and table.pack
  • Closures and function factoriesFunctions that keep their own state
  • String patternsThe find, match, gmatch and gsub functions
  • Raising and catching errorsRaising with error, catching with pcall, and returning nil with a message
  • Scope and localThe local keyword, shadowing and recursion

Track contents

10 lessons, 2 hours in total
  1. 1Your first scriptLuaThe local keyword, print and the .. operator for joining strings
  2. 2Numbers and stringsLuaThe //, % and ^ operators and string functions
  3. 3ConditionalsLuaOnly nil and false count as false
  4. 4LoopsLuaLooping with for, while and repeat, and leaving with break
  5. 5Functions and multiple return valuesLuaReturning several values with return and defaults with or
  6. 6Any number of argumentsLuaThe three dots ..., select and table.pack
  7. 7Closures and function factoriesLuaFunctions that keep their own state
  8. 8String patternsLuaThe find, match, gmatch and gsub functions
  9. 9Raising and catching errorsLuaRaising with error, catching with pcall, and returning nil with a message
  10. 10Scope and localLuaThe local keyword, shadowing and recursion