Lua uses print() to output text. It’s a lightweight, fast, and embeddable scripting language popular in game development (Roblox, World of Warcraft addons) and embedded systems.
Lua
Learn Lua - the lightweight, embeddable scripting language used in game development and beyond.
Hello World
Run this example to see how it works and then try the exercise.
Click "Run" to see the example in action...Click "Run" to execute your code...How do you write a single-line comment in Lua?
SUMMARY
In this section, you learned how to print output to the console. Next, you'll learn how to declare variables and work with different data types.
Variables and Types
Lua is dynamically typed. Variables are global by default - use local for local variables. Lua has 8 basic types: nil, boolean, number, string, function, userdata, thread, and table.
Run this example to see how it works and then try the exercise.
Click "Run" to see the example in action...Click "Run" to execute your code...What keyword makes a variable local in Lua?
SUMMARY
In this section, you learned how to declare variables and work with different data types. Next, you'll learn how to manipulate and work with strings.
Arithmetic Operations
Lua offers string concatenation with .. and many string manipulation functions in the string library.
Run this example to see how it works and then try the exercise.
Click "Run" to see the example in action...Click "Run" to execute your code...What operator concatenates strings in Lua?
SUMMARY
In this section, you learned how to manipulate and work with strings. Next, you'll learn how to perform mathematical operations.
Unlock 10 More Lessons
You've completed the free preview! Upgrade to Pro to access all 12 lessons in this course, plus advanced projects and certificates.
- String Operations
- Conditionals
- For Loops
- While Loops
- Functions
- Tables as Arrays
- Tables as Dictionaries
- Metatables and OOP
- Final Project: Student Grade System