summaryrefslogtreecommitdiff
path: root/script/core/noder.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2021-06-23 16:15:13 +0800
committer最萌小汐 <sumneko@hotmail.com>2021-06-23 16:15:13 +0800
commit366d163edf1373ca4f7c56ef44b77b818d9ee4f8 (patch)
tree768aef8f9a8c2f6c8dc046a019dd43a9a3d1e299 /script/core/noder.lua
parent1e7e9eba031eadfb5045a7fec01ee8519a967be6 (diff)
downloadlua-language-server-366d163edf1373ca4f7c56ef44b77b818d9ee4f8.zip
fix #567
Diffstat (limited to 'script/core/noder.lua')
-rw-r--r--script/core/noder.lua11
1 files changed, 11 insertions, 0 deletions
diff --git a/script/core/noder.lua b/script/core/noder.lua
index 413f2007..d6d0f59a 100644
--- a/script/core/noder.lua
+++ b/script/core/noder.lua
@@ -988,6 +988,17 @@ function m.getLastID(id)
return lastID
end
+---获取ID的长度
+---@param id string
+---@return integer
+function m.getIDLength(id)
+ if not id then
+ return 0
+ end
+ local _, count = id:gsub(SPLIT_CHAR, SPLIT_CHAR)
+ return count + 1
+end
+
---测试id是否包含field,如果遇到函数调用则中断
---@param id string
---@return boolean