Variables, Tables, and Expressions
The starting point for any programming language is learning how to store values and data.
What are some examples? In a game you’ll need to store things like a player’s name and status, the number of lives, the score, the enemies, and the remaining time.
These values are from different types. For instance:
- A name is a string
- A score is a number
Store Simple Values
Simple useful types in Lua are numbers, strings, and Booleans.
To store a value of one of these types, you have to name the value and assign it.
Look at this:
This gives a string the name “title” and assigns it “Rocky” as a value. Please note ...
Get Create 2D Mobile Games with Corona SDK now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.