直接贴代码
local danli = nil
local classname = class("classname")
function classname:getInstance()
if danli == nil then
danli = classname.new()
end
return danli
return classname
使用
local duixiagn = classname:getInstance()