Add Component Negation

Fixes #32
This commit is contained in:
Pablo Ariel Mayobre 2023-02-14 18:14:22 -03:00 committed by Pablo Mayobre
parent 1c99d534c2
commit ea59529ddc
No known key found for this signature in database
GPG key ID: 13A2F589D013E0E7
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