Essentially, what metatables do is allow you to define how a table reacts to different operations and even tag on some default values. The true power of metatables is an advanced topic. Many only use them to build structures similar to classes, but you can use them to hook/filter content, tweak how garbage collection works on the table and/or its contents, define what happens in math and comparison operations, and many more.
Originally Posted by Vlad
|
PiL is a good introduction to Lua. If you want more detail, I'd suggest the reference manual.
http://www.lua.org/manual/5.1/manual.html#2.8