lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


> In Lua 5.3 equal functions are converted to different dumps when
> strip==true.
> 
> local function f(x) return x+1 end
> local function g(y) return y+1 end
> print(string.dump(f, true) == string.dump(g, true))  --> false on Lua 5.3,
> true on LuaJIT
> 
> If both dumps are load()-ed to exactly the same closures, why these dumps
> are not equal after stripping debug info?

Because the dump keeps the information about where the function was defined.
If you save the bytecodes and list them with luac you'll see

	function <?:1,1> (3 instructions at ...)
	function <?:2,2> (3 instructions at ...)

which say that f was defined at line 1 and g at line 2.