summaryrefslogtreecommitdiff
path: root/server-beta/src/seacher/table.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2019-10-22 21:00:24 +0800
committer最萌小汐 <sumneko@hotmail.com>2019-10-22 21:00:24 +0800
commit863f1fc0350fff0d7b7e2a376d82ccaaf301f4ce (patch)
treee5da7c758612ccf574f0dfc563690306550a1d36 /server-beta/src/seacher/table.lua
parent1f0a645cddeae4caba21c655651d97b5313d2302 (diff)
downloadlua-language-server-863f1fc0350fff0d7b7e2a376d82ccaaf301f4ce.zip
整理代码
Diffstat (limited to 'server-beta/src/seacher/table.lua')
-rw-r--r--server-beta/src/seacher/table.lua22
1 files changed, 22 insertions, 0 deletions
diff --git a/server-beta/src/seacher/table.lua b/server-beta/src/seacher/table.lua
new file mode 100644
index 00000000..851ee791
--- /dev/null
+++ b/server-beta/src/seacher/table.lua
@@ -0,0 +1,22 @@
+local guide = require 'parser.guide'
+
+local m = {}
+
+function m:eachField(source, key, callback)
+ for i = 1, #source do
+ local src = source[i]
+ if key == guide.getKeyName(src) then
+ if src.type == 'tablefield' then
+ callback(src, 'set')
+ elseif src.type == 'tableindex' then
+ callback(src, 'set')
+ end
+ end
+ end
+end
+
+function m:eachValue(source, callback)
+ callback(source)
+end
+
+return m