viruscamp / luadec

Lua Decompiler for lua 5.1 , 5.2 and 5.3
1.14k stars 343 forks source link

a bug in lua5.3 #51

Open QSlash opened 7 years ago

QSlash commented 7 years ago

test.lua: local arry={1,2,3} function check(idx) return arry[idx] or arry[#arry] end

cmd: luac test.lua luadec luac.out>res.lua

res.lua: -- Decompiled using luadec 2.2 rev: $WCREV$ for Lua 5.3 from https://github.com/viruscamp/luadec -- Command line: luac.out

-- params : ... -- function num : 0 , upvalues : _ENV local arry = {1, 2, 3} check = function(idx) -- function num : 0_0 , upvalues : arry if not arry[idx] then return arry[#arry] end end

rocky commented 2 years ago

Seems like a similar thing to https://github.com/viruscamp/luadec/issues/75 is going on here. So also see the section "Status" in https://github.com/sztupy/luadec51/blob/master/README.markdown

And as with #75 this problem is fixed in unluac