lua-users home
lua-l archive

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


> isn't '-' part of the Number terminal?

No.

> I don't think it is handled as an unary minus opcode applied on the absolute value described by the following digits.

It is. But Lua does constant folding and the unary minus opcode disappears.

Try luac -l -p - on
	a = -34
	a = - 34
	a = -(34)
	a = -(30+4)

All four lines generate the same bytecode:

	LOADK    	0 -2	; -34
	SETGLOBAL	0 -1	; a