lua-users home
lua-l archive

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


To quote the manual:

> A program can modify the behavior of the length operator for any value but strings through the __len metamethod (see §2.4).

This does not require that the value be an integer, but instead "any value".

On Tue, Mar 13, 2018 at 3:22 PM Dibyendu Majumdar <mobile@majumdar.org.uk> wrote:
Hi,

I found that Ravi cannot execute lpeg tests. Upon further
investigation, it seems the issue is because Ravi expects '#' operator
to return an integer result, but lpeg defines a metamethod for this
operator that returns a userdata object.

Is this a violation of the contract for # operator, or is my
understanding incorrect about the result of this operator?

Thanks and Regards
Dibyendu

--
--
Ryan | Charles <vandor2012@gmail.com>
Software Developer / System Administrator
https://hashbang.sh