lua-users home
lua-l archive

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

On 25/06/16 03:41 PM, Roberto Ierusalimschy wrote:
Why doesn't table.pack set a default metatable that uses self.n for __len?
Because using an explicit ".n" in the code (and knowing what it means)
seem simpler.

-- Roberto

I see... Also why doesn't __len support numbers?

Lua 5.3.3  Copyright (C) 1994-2016, PUC-Rio
> #setmetatable({},{__len=3})
stdin:1: attempt to call a number value
stack traceback:
    stdin:1: in main chunk
    [C]: in ?

Disclaimer: these emails may be made public at any given time, with or without reason. If you don't agree with this, DO NOT REPLY.