lua-users home
lua-l archive

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


gary ng wrote:
> What would it mean if data is a table ? Would it be a
> positional "normal add"(like in matrix operation t[x]
> = t[x] + data[x] for x <= len of data) or extend or
> just add one item data to the table ? What if I want
> one behaviour in certain cases and the other in some
> other cases ?

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.)

-- 
+- David Given --McQ-+ "Gaping from its single obling socket was
|  dg@cowlark.com    | scintillating, many fauceted scarlet emerald..."
| (dg@tao-group.com) | --- Jim Theis, _The Eye of Argon_ (spelling
+- www.cowlark.com --+ original)


Attachment: signature.asc
Description: OpenPGP digital signature