|
Mike Pall wrote:
Alex Davies wrote:I wonder if LuaJit 2.x would incorrectly optimise the temp variable away =/? I'm guessing not, as the gc only runs in interpreted mode, but still interesting.
...
But you still need to keep the strong reference for semantic correctness and for the interpreter. And you should copy the strong reference to the weak reference, not the other way round.
Thanks Alex, Roberto, Mike. I rewrote the code as Roberto suggested. And Mike's last comment made me aware of my mistake (using the weak reference throughout the code instead of the strong one).
Regards, Ignacio