tables
tables
These pages are intended to be an introduction to the nature and
use of tables in Lua, for the curious and those new to the language.
Those who are not new to the language are invited to correct my errors
and suggest improvements.
I find that to understand a topic it is often useful to delve a little
into the origins of words. Please be patient. In ancient Greek the word
τράπεζα has two main meanings: a
table for putting food on, and a table used by a money-changer. Our word
bank originally meant no more than
bench. In ancient
times a business deal, say the deposit of money with a banker, would
be identified by matching tokens - created by breaking a stick or
a fragment of pottery: the matching of the break on the two pieces would
authenticate the client. Lua tables may be understood in the latter sense.
An item in a Lua table consists of two things - a key (the authenticating
token) and a value (the goods deposited). Perhaps the word
bank
should join
array,
dictionary and
library as
synonyms for
table?