This code works:
1
2
3
4
5
6
7
8
9
2
3
4
5
6
7
8
9
tab = { event = function() print(1) end; } function button() return tab end button().event()
1
2
3
2
3
button() .event() .event()
tab = { event = function() print(1) end; } function button() return tab end button().event()
button() .event() .event()
tab = { event = function() return {event = function() print(1) end} end } function button() return tab end button().event().event()
tab = {} function tab.event() print(1) return tab end function button() return tab end button().event().event()
tab = {} function tab:event() print(1) return self end function button() return tab end button():event():event()