清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>
Singleton = {};
local _instance;
function Singleton.getInstance()
if not _instance then
_instance = Singleton;
end
--'any new methods would be added to the _instance object like this'
_instance.getType = function()
return 'singleton';
end
return _instance
end
function Singleton:new()
print('Singleton cannot be instantiated - use getInstance() instead');
end