Day 2: Tables All the Way Down
Today, we’re going to look at two concepts that define the Lua experience: tables and coroutines. As with many prototype languages, tables define your data. Coroutines define your control flow. Both are simple but tremendously powerful, underpinning everything from Lua’s object system to your own domain-specific languages.
Let’s begin with tables.
One of the first things new programming language tutorials do is inundate you with a laundry list of data structures: arrays, tuples, vectors, lists, dictionaries, and so on. Each of these has its own API, syntax, quirks, and performance characteristics.
These collections are all useful, but when I’m first trying out a language, I’m usually wondering about much more basic ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access