[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Lua 5.2 new function reference inside a loop
- From: Paul Bernier <bernier.pja@...>
- Date: Mon, 15 Sep 2014 15:56:26 +0200
Hello all,
I just noticed an unexpected (to me) behavior of Lua 5.2 and I'd like some enlightenment on it:
for i=0,2 do
local a = function() end;
print(a);
end
This code will produce on Lua5.2 something like :
function: 0x20fcc70
function: 0x20fcc70
function: 0x20fcc70
Whereas with Lua5.1 or LuaJIT it'd produce:
function: 0x41e71058
function: 0x41e71078
function: 0x41e71158
My questions are:
-why Lua5.2 has this behavior?
-is there any workaround (other than modifying the VM) to get the second behavior?
Thanks!