[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [ANN] Lua 5.2.0 (rc1) now available
- From: Roberto Ierusalimschy <roberto@...>
- Date: Thu, 24 Nov 2011 14:32:43 -0200
> A numerical constant can be written...
>
> As I understand it, there is no such thing as a negative numerical
> constant. However, these do exist:
> >luac -l -
> a = -3
Like -x, -3 is the minus unary operator applied over the constant 3.
(If -3 was a lexical constant, Lua would read "x-3" as "x" followed by
"-3".)
Lua does constant folding, so -(3) is coded internally as -3, but this
is an optimization. (Check the code for "a = 3 + 5".)
-- Roberto