[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Possible typo with define tonumberns?
- From: Ahmed Charles <me+lua-l@...>
- Date: Tue, 27 Oct 2020 00:45:30 +0000
‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Monday, October 26, 2020 4:04 PM, Ranier Vilela <ranier.vf@gmail.com> wrote:
> Possible typo with define tonumberns?
>
> Should it be?
>
> #define tonumberns(o,n) \
> (ttisfloat(o) ? (*(n) = fltvalue(o), 1) : \
> (ttisinteger(o) ? (*(n) = cast_num(ivalue(o)), 1) : 0))
Note: the macro is used (consistently) as `tonumberns(p1, n1)`, where n1 is `lua_Number n1;`. n isn't a pointer, it's a number. Every binary operation between two lua_Number's goes through this macro, so it definitely works as is, or at least, it doesn't have a typo which is this trivial.