lua-users home
lua-l archive

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


On 08/12/2012 07:27, Dirk Laurie wrote:
I want to create OO objects like this:

obj = ({"item1","item2","item3"}):class("list")


Why not simply create the object this way?

obj = list {"item1","item2","item3"}

or just use a metatable's alias as pseudo-syntactic prefix (my preferred solution, as if Lua had native arrays/lists ;-):
    obj = L{"item1","item2","item3"}

Denis

(by the way, why are items quoted in the op's syntax?)