lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On 01/10/2011 22.25, Petite Abeille wrote:

On Oct 1, 2011, at 9:52 PM, Dirk Laurie wrote:

  2. Lua has only one data structuring mechanism: `table`.

Furthermore, if one is so inclined, one should feel free to build any type of
>specialized data structure out of the basic
>building blocks provided by the language. [...]

Very, true.

This is IMO a big newbie gotcha: Lua tables are so "high-level", i.e. they can be easily used to implement lists, trees, maps, stacks, etc., that one can easily think they should provide a much fatter interface (the common problem of getting into Lua's spirit).

It's not easy to grasp initially that one can use OOP techniques to turn a generic table into, say, a "stack object", with usual push/pop methods.





Cheers.
-- Lorenzo