mirror of
https://github.com/Keyslam-Group/Concord.git
synced 2025-09-02 04:13:58 -04:00
Allowed for component access via Entity[Component]
This commit is contained in:
parent
cc619dae66
commit
30a3b38fe1
1 changed files with 4 additions and 1 deletions
|
@ -29,7 +29,9 @@ function Entity:give(component, ...)
|
|||
error("bad argument #1 to 'Entity:give' (Component expected, got "..type(component)..")", 2)
|
||||
end
|
||||
|
||||
self.components[component] = component:__initialize(...)
|
||||
local comp = component:__initialize(...)
|
||||
self.components[component] = comp
|
||||
self[component] = comp
|
||||
|
||||
return self
|
||||
end
|
||||
|
@ -56,6 +58,7 @@ function Entity:apply()
|
|||
|
||||
for component, _ in pairs(self.removed) do
|
||||
self.components[component] = nil
|
||||
self[component] = nil
|
||||
self.removed[component] = nil
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue