[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: "or" shortcut does not work - but why?
- From: roberto@... (Roberto Ierusalimschy)
- Date: Mon, 18 Jun 2007 16:43:40 -0300
> Well, I added a simple "printf" for testing purposes, of course
> The output of that printf statement is as follows:
>
> TEST: l_isfalse = 1, GETARG_C = 1
Just to be sure, print also the value of (l_isfalse == GETARG_C).
> I'm a bit unsure how to interpret these values:
>
> - l_isfalse = 1 - looks ok, doesn't it?
> - GETARG_C = 1 - is that correct? (shouldn't it be 0?)
This is correct. "GETARG_C = 1" means "jump if the value is true" (or,
as documented in lopcodes.h, "skip the jump if the value is not true").
This is what we want, as the jump would skip the following LOADK. As it
is (1 == 1), the interpreter should not jump over the next instruction
(LOADK), so the final value should be the constant (the string). Now
we should check whether it is not jumping (despite the 1==1) or if
the problem is somewhere else.
-- Roberto