lua-users home
lua-l archive

Re: Lua 5.2 __len metamethod

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


2011年6月19日 Krunal Rao <krunal.rao78@gmail.com>
>
> In Lua 5.2 it is possible to define the __len metamethod (# operator
> method) for tables as well.
>
> Is there a way to access the raw (primitive) length operator for a
> table which has a custom __len defined in the same way as rawget /
> rawset allow this for __index and __newindex?
>
yes, there is a new basic function : rawlen (v)
  Returns the length of the object v, which must be a table or a
string, without invoking any metamethod. Returns an integer number.
> Thank you
>

AltStyle によって変換されたページ (->オリジナル) /