viruscamp / luadec

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

surround () before OP_SETTABLE OP_GETTABLE OP_CALL OP_SELF #17

Closed viruscamp closed 10 years ago

viruscamp commented 10 years ago
-- OP_SETTABLE MakeIndex( DOT )
local x = (1+a).f4
x = ({0,1}).a
x = ({2,3,4}+5)[6]

--  OP_GETTABLE MakeIndex( DOT )
;(1+a).f3 = x
--;({0,1}).a = x
;({2,3,4}+5)[6] =x

-- OP_CALL
_a22_2_a()
a()
a.f3()
;(1+a)(s)
;(function(f) print(type(f)) end)(3)

--OP_SELF MakeIndex( SELF )
a:f() -- decompiled as (a:f)() imported in e4f956c
a:f3() -- decompied as (a:f3)() from long ago
;(2+a):f3()

13

viruscamp commented 10 years ago

(2+a):f3() --> 2+a:f3()

fix OP_SELF just like in OP_CLOSURE

viruscamp commented 10 years ago

OP_SETTABLE and OP_GETTABLE have the same problem