Add Component Negation

Fixes #32
This commit is contained in:
Pablo Ariel Mayobre 2021-01-09 00:22:35 -03:00
parent dd155588a0
commit 8f57cadce9
No known key found for this signature in database
GPG key ID: 5ACD9E6858BEB0A9
4 changed files with 51 additions and 20 deletions

View file

@ -19,6 +19,10 @@ function Component.new(name, populate)
error("bad argument #1 to 'Component.new' (string expected, got "..type(name)..")", 2)
end
if (string.match(name, Components.__REJECT_MATCH) ~= "") then
error("bad argument #1 to 'Component.new' (Component names can't start with '"..Components.__REJECT_PREFIX.."', got "..name..")", 2)
end
if (rawget(Components, name)) then
error("bad argument #1 to 'Component.new' (ComponentClass with name '"..name.."' was already registerd)", 2) -- luacheck: ignore
end