-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
EinfachMaxPC
committed
Apr 5, 2021
1 parent
a2e8ecd
commit 3356f79
Showing
10 changed files
with
112 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
Singleton = {} | ||
|
||
function Singleton:GetSingleton(...) | ||
if not self.ms_Instance then | ||
self.ms_Instance = self:New(...) | ||
end | ||
return self.ms_Instance | ||
end | ||
|
||
function Singleton:New(...) | ||
self.New = function() end | ||
local inst = new(self, ...) | ||
self.ms_Instance = inst | ||
return inst | ||
end | ||
|
||
function Singleton:IsInstantiated() | ||
return self.ms_Instance ~= nil | ||
end | ||
|
||
function Singleton:virtual_destructor() | ||
for k, v in pairs(super(self)) do | ||
v.ms_Instance = nil | ||
v.New = Singleton.New | ||
end | ||
end |
Oops, something went wrong.