lua-users home
lua-l archive

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



On 12-Jan-06, at 12:06 PM, Roberto Ierusalimschy wrote:

As a general rule, Lua does not allow the redefinition of operators for
cases already defined in the language (e.g., add for numbers, concat for
strings, call for functions).

On the other hand, table get and set is redefinable (partially).


(On the other hand, we do understand that tables may have a different
status, as they are used to represent "all other types" in Lua.)

I think that's the essential point. #table is only useful for a subset of tables (i.e. non-sparse arrays); there are many cases where you might want to redefine it; for example, a pure proxy table (commonly used to allow complete redefinition of get and set).