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
用户登录
还没有账号?立即注册
用户注册
投稿取消
文章分类: |
|
还能输入300字
上传中....