Why Luau?
Rive selected Luau (pronounced "Loo-ow") as its scripting language. Luau is a fast, small, safe, and gradually typed scripting language derived from Lua 5.1, primarily developed and maintained by Roblox.
Why Luau for a Design Tool?β
π Performance and Sizeβ
Real-time graphics demand efficiency. Luau's highly optimized Virtual Machine (VM) ensures scripts run quickly without causing frame drops, and its small footprint is crucial for web deployment.
π Embeddabilityβ
Luau is designed to be easily integrated into larger C++ applications, like the Rive Editor and its various runtimes (iOS, Android, Web, Flutter, etc.).
π Gradual Typing (The Key Advantage)β
This is the cornerstone of the Rive scripting experience. While Luau can be written dynamically (like JavaScript or standard Lua), it supports a robust type system:
-
Robustness: Types help catch errors before the animation even runs. If you try to assign a Color where a number is expected, the editor flags it immediately.
-
Tooling: Rive generates Luau type definitions directly from its C++ engine APIsβpaths, shapes, transforms, artboards, view models, and more. This powers accurate autocomplete (IntelliSense).
π― Simple Semanticsβ
Based on Lua, the syntax is minimalist and accessible, making it easier for designers and new programmers to learn.
Luau vs Other Languagesβ
| Feature | Luau | JavaScript | Python |
|---|---|---|---|
| Type System | Gradual (optional) | Dynamic | Dynamic |
| Performance | Very fast | Fast | Slower |
| Bundle Size | ~200KB | Large | N/A |
| Learning Curve | Easy | Medium | Easy |
| Rive Integration | Native | N/A | N/A |
Knowledge Checkβ
Ready to Start Scripting?β
Now that you understand WHY Rive uses Luau, it's time to write your first script. Choose the path that fits your experience:
Start here: Your First Rive Script
We'll teach you programming concepts from scratch with clear explanations and interactive exercises. No prior experience needed.
Start here: How Rive Scripts Work
Get up to speed fast with side-by-side comparisons to what you already know. Understand the Rive script structure through familiar concepts.
Both paths lead to the same place β Luau Fundamentals β so you can always reference the other track later if you want a different perspective!