lua-users home
lua-l archive

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


It's my mistake. After rereading the explanation of
the arithmetic metamethods, I understand the problem
is that the interpreter will use a __sub metamethod
from the second argument if the first one doesn't have
one, which of course nil doesn't.

Sorry for the inconvenience.

--- Luiz Henrique de Figueiredo
<lhf@tecgraf.puc-rio.br> wrote:

> > I have some code that creates an object of a date
> type
> > (very similar to the one from PIL) and then
> subtracts
> > it from nil. I would expect this to raise the
> "attempt
> > to perform arithmetic on a nil value" error, but
> it
> > doesn't; instead, I get a result of nil. Does this
> > make any sense?
> 
> Perhaps this is related to
> http://www.lua.org/bugs.html#5.1.2-2 ?
> 
> > I can post code if it would help.
> 
> Please do.
>