lua-users home
lua-l archive

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


On 13 March 2018 at 20:46, Roberto Ierusalimschy <roberto@inf.puc-rio.br> wrote:
>> I don't interpret the manual that way. I read that as saying that you
>> cannot modify the length operator for a string. But __len is defined
>> as a length operation, is it not?
>
> I am not sure what you mean by "__len is defined as a length operation".
> It is *called* the length operator, but a name does not give its
> semantics. __add is also related to the "addition operation", but that
> name does not imply that it is an addition.
>
> Note the following:
>
> 1) The __eq metamethod, which always returns a boolean, says so:
>
>   "The result of the call is always converted to a boolean."
>
> 2) The API for the length operation does not return a number, but a
> Lua value. (The same is true for addition, but not for comparisons.)
>

Ok.

Thanks