summaryrefslogtreecommitdiff
path: root/honey/ecs/ecs.lua
diff options
context:
space:
mode:
Diffstat (limited to 'honey/ecs/ecs.lua')
-rw-r--r--honey/ecs/ecs.lua4
1 files changed, 3 insertions, 1 deletions
diff --git a/honey/ecs/ecs.lua b/honey/ecs/ecs.lua
index 301ed36..dda99cb 100644
--- a/honey/ecs/ecs.lua
+++ b/honey/ecs/ecs.lua
@@ -179,7 +179,9 @@ end
-- get a specific component from an entity
function EntityDb.getComponent(self, id, name)
self:checkIsValid(id)
- return self.components[name].data[id]
+ local components = self.components[name]
+ if not components then return nil end
+ return components.data[id]
end