summaryrefslogtreecommitdiff
path: root/server/src/emmy/class.lua
diff options
context:
space:
mode:
authorsumneko <sumneko@hotmail.com>2019-04-28 20:09:43 +0800
committersumneko <sumneko@hotmail.com>2019-04-28 20:09:43 +0800
commit0bc67627a4409a08e34be0b44cba928cdacf8192 (patch)
treea78bf45ded637b3a6424653745895b6c327cb578 /server/src/emmy/class.lua
parentb4ed749782ba58140c8d7878e4b27ec6b3d2fffb (diff)
downloadlua-language-server-0bc67627a4409a08e34be0b44cba928cdacf8192.zip
emmy.field
Diffstat (limited to 'server/src/emmy/class.lua')
-rw-r--r--server/src/emmy/class.lua17
1 files changed, 17 insertions, 0 deletions
diff --git a/server/src/emmy/class.lua b/server/src/emmy/class.lua
index 84854fc5..a7417210 100644
--- a/server/src/emmy/class.lua
+++ b/server/src/emmy/class.lua
@@ -33,6 +33,23 @@ function mt:eachChild(callback)
end)
end
+function mt:addField(field)
+ if not self._fields then
+ self._fields = {}
+ end
+ self._fields[#self._fields+1] = field
+end
+
+function mt:eachField(callback)
+ if not self._fields then
+ return
+ end
+ ---@param field EmmyField
+ for _, field in ipairs(self._fields) do
+ callback(field)
+ end
+end
+
return function (manager, source)
local self = setmetatable({
name = source[1][1],