summaryrefslogtreecommitdiff
path: root/server/src/emmy/class.lua
diff options
context:
space:
mode:
Diffstat (limited to 'server/src/emmy/class.lua')
-rw-r--r--server/src/emmy/class.lua20
1 files changed, 19 insertions, 1 deletions
diff --git a/server/src/emmy/class.lua b/server/src/emmy/class.lua
index f1101e91..84854fc5 100644
--- a/server/src/emmy/class.lua
+++ b/server/src/emmy/class.lua
@@ -1,5 +1,6 @@
local listMgr = require 'vm.list'
+---@class EmmyClass
local mt = {}
mt.__index = mt
mt.type = 'emmy.class'
@@ -16,11 +17,28 @@ function mt:getSource()
return listMgr.get(self.source)
end
-return function (source)
+function mt:setValue(value)
+ self.value = value
+end
+
+function mt:getValue()
+ return self.value
+end
+
+function mt:eachChild(callback)
+ self._manager:eachClass(self.name, function (obj)
+ if obj.type == 'emmy.typeUnit' then
+ callback(obj)
+ end
+ end)
+end
+
+return function (manager, source)
local self = setmetatable({
name = source[1][1],
source = source.id,
extends = source[2] and source[2][1],
+ _manager = manager,
}, mt)
return self
end