lua-users home
lua-l archive

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

Bruno Silva wrote:
> This approach works fine, but there is one piece missing: if the vectors are
> lua tables, you can actually enumerate the fields in lua (with foreach(),
> for example). So you can print a vector with foreach(v,print). Since there
> are currently no tag methods for enumerating elements, you can't really make
> the behavior of usertags indistinguishable from that of true lua tables for
> now.

You "could" make it work by overloading foreach...  Not that I would
advocate that *g*.   But is that a requiredment to behave exactly like
tables?  He may want to add arithmetic tag methods and then they are
really different.  Using the get/settable method is just a way to get
a nice syntax to access fields.

A "next" and "tostring" method would be really nice though.

Ciao, ET.