Data update
This commit is contained in:
parent
4bb20c9b71
commit
cbaf4c4b64
12390 changed files with 318560 additions and 27248 deletions
19
Task/Singleton/Pluto/singleton-1.pluto
Normal file
19
Task/Singleton/Pluto/singleton-1.pluto
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
-- Singleton.pluto --
|
||||
|
||||
local instance = nil
|
||||
|
||||
class singleton
|
||||
static function getInstance()
|
||||
if !instance then new singleton() end
|
||||
return instance
|
||||
end
|
||||
|
||||
function __construct()
|
||||
assert(!instance, "The singleton instance already exists.")
|
||||
instance = self
|
||||
end
|
||||
|
||||
function print()
|
||||
print("Hello, I'm a singleton.")
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue