TEST [[ function mt:() end function mt:b() mt:() end ]] TEST [[ function mt:() end function mt:m2() self:() end ]] TEST [[ function mt:m3() mt:() end function mt:() end ]] TEST [[ function mt:m3() self:() end function mt:() end ]] TEST [[ local mt mt.__index = mt function mt:() end local obj = setmetatable({}, mt) obj:() ]] TEST [[ local mt mt.__index = mt function mt:() end local obj = setmetatable({}, mt) obj:() ]] TEST [[ local mt function mt:() end local obj = setmetatable({}, { __index = mt }) obj:() ]] TEST [[ local mt local api function mt:() end setmetatable(api, { __index = mt }) api:() ]] TEST [[ local mt function mt:x() self.() end local obj = setmetatable({}, { __index = mt }) obj. = 1 ]] TEST [[ local mt function mt:x() self.() end local obj = setmetatable({ = 1 }, { __index = mt }) ]] TEST [[ local mt function mt:x() self.a.() end local obj = setmetatable({ a = { = 1, } }, { __index = mt }) ]] TEST [[ local sm = setmetatable local mt mt.__index = mt function mt:() end local obj = sm({}, mt) obj:() ]] TEST [[ local mt = {} function mt:() end local obj = setmetatable({}, {__index = mt}) function obj:x() end mt:() ]] TEST [[ local mt = {} function mt:x() end local obj = setmetatable({}, {__index = mt}) function obj:() end obj:() ]]