lua-users home
lua-l archive

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



--- David Given <dg@cowlark.com> wrote:
> In which case you'd use tables with different
> metamethods for each kind of
> thing --- e.g., a Matrix class if you want member
> addition behaviour. What
> we're currently discussing (I hope) is the default
> behaviour for tables;
> specifically, tables as arrays. (I'd assume that +=
> on a table that wasn't an
> array would have the same undefined behaviour as the
> # operator.)
> 
But the "+="(or "+") operator can be quite ambigious
in the context of table, even for just default
behaviour.

t={1,2,3,4}
d={5,6,7,8}

t += d

should I get {1,2,3,4,5,6,7,8} or {1,2,3,4,d} as I see
adding two table together(i.e. extend) is just as
natural as adding two number together. t+d =
{1,2,3,4,5,6,7,8} is the default behaviour in python
list.

that is also true for {1,2,3,4,d}. As d in this case
is being treated just as another object putting at the
end of a table.

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com