function SingleTon:new() local store = nil return function(self) if store then return store end local o ={} setmetatable(o,self) self.__index = self store = o return o end end SingleTon.instance = SingleTon:new()
function SingleTon:new() local store = nil return function(self) if store then return store end local o ={} setmetatable(o,self) self.__index = self store = o return o end end SingleTon.instance = SingleTon:new()
转载于:https://www.cnblogs.com/guoliangjun/p/5909635.html