From 8ba5644fb2a71ad3291cb262d88871c02bf72ad3 Mon Sep 17 00:00:00 2001 From: Kazhnuz Date: Mon, 1 Apr 2019 12:47:08 +0200 Subject: [PATCH] modules/world: add a way of counting actors --- gamecore/modules/world/baseworld.lua | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gamecore/modules/world/baseworld.lua b/gamecore/modules/world/baseworld.lua index fb02132..c4a800c 100644 --- a/gamecore/modules/world/baseworld.lua +++ b/gamecore/modules/world/baseworld.lua @@ -10,6 +10,10 @@ function BaseWorld:registerEntity(entity) table.insert(self.entities, entity) end +function BaseWorld:countEntity() + return #self.entities +end + function BaseWorld:update(dt) for i,v in ipairs(self.entities) do v:update(dt)