Huh? I thought only actually used vars were captured as upvalues. At least from performance / memory usage standpoint that would be common sense.
On Thu, Jan 31, 2019 at 12:28 PM Rodrigo Azevedo <email@example.com> wrote:
Anyone could tell me why the code below returns 'false', when I
expected a 'true' instead. Tested with lua5.2, lua5.3 and
local f1 = string.dump(function(x) x=x+1 return x end,true)
local f2 = string.dump(function(x) x=x+1 return x end,true)
print(f1 == f2)
Rodrigo Azevedo Moreira da Silva
Because f2 includes f1 in its upvalues, so they have different contexts.