[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: "or" shortcut does not work - but why?
- From: Nick Gammon <nick@...>
- Date: Sun, 17 Jun 2007 17:23:15 +1000
On 17/06/2007, at 4:59 PM, Andreas Rozek wrote:
the compiler has been ported - what is the recommended way to
post the results of a compilation (i.e., a luac run) to this
list?
This is what I got trying your test (successfully):
$ luac -l -
local Result = false; -- you could also use "nil" here
Result = Result or "anything else";
io.stdout:write("Result = '"..tostring(Result).."'");
main <stdin:0,0> (15 instructions, 60 bytes at 0x805d190)
0+ params, 6 slots, 0 upvalues, 1 local, 7 constants, 0 functions
1 [2] LOADBOOL 0 0 0
2 [3] TEST 0 0 1
3 [3] JMP 1 ; to 5
4 [3] LOADK 0 -1 ; "anything else"
5 [4] GETGLOBAL 1 -2 ; io
6 [4] GETTABLE 1 1 -3 ; "stdout"
7 [4] SELF 1 1 -4 ; "write"
8 [4] LOADK 3 -5 ; "Result = '"
9 [4] GETGLOBAL 4 -6 ; tostring
10 [4] MOVE 5 0
11 [4] CALL 4 2 2
12 [4] LOADK 5 -7 ; "'"
13 [4] CONCAT 3 3 5
14 [4] CALL 1 3 1
15 [4] RETURN 0 1