lua-users home
lua-l archive

about tables, Table and metatables :o)

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



Another noob tought.
t ={"a","b","c"}
s = t:concat() -- notworking same has s= t.concat(t)
s = Table.concat(t) 
tables don't have metatable... 
but why ? :o)
My guess is 99% of tables in script are used like a default table and could share Table by default..
And keep the short calling way valid is that case.
When you need to use tables for others purpose; 
class base or prototype base languages, mockup object, other data structures  etc etc ...
you will need to define a metatable and add the others functions you need ( constructor, copier, destructor ...)
so in those case you need to have an explicit constructor.
so why not offer by default, like for String, a metatable for table ?
voidptr :-) 


AltStyle によって変換されたページ (->オリジナル) /