mirror of
https://github.com/Keyslam-Group/Concord.git
synced 2025-08-31 09:28:30 -04:00
Added type checking
This commit is contained in:
parent
fda6cd7237
commit
281bb53a5b
7 changed files with 101 additions and 8 deletions
|
@ -1,5 +1,7 @@
|
|||
local PATH = (...):gsub('%.init$', '')
|
||||
|
||||
local Type = require(PATH..".type")
|
||||
|
||||
local Concord = {}
|
||||
|
||||
--- Initializes the library with some optional settings
|
||||
|
@ -17,10 +19,18 @@ function Concord.init(settings)
|
|||
Concord.instances = {}
|
||||
|
||||
Concord.addInstance = function(instance)
|
||||
if not Type.isInstance(instance) then
|
||||
error("bad argument #1 to 'Concord.addInstance' (Instance expected, got "..type(instance)..")", 2)
|
||||
end
|
||||
|
||||
table.insert(Concord.instances, instance)
|
||||
end
|
||||
|
||||
Concord.removeInstance = function(instance)
|
||||
if not Type.isInstance(instance) then
|
||||
error("bad argument #1 to 'Concord.addInstance' (Instance expected, got "..type(instance)..")", 2)
|
||||
end
|
||||
|
||||
for i, instance in ipairs(Concord.instances) do
|
||||
table.remove(Concord.instances, i)
|
||||
break
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue