summaryrefslogtreecommitdiff
path: root/server-beta/src/parser/guide.lua
diff options
context:
space:
mode:
Diffstat (limited to 'server-beta/src/parser/guide.lua')
-rw-r--r--server-beta/src/parser/guide.lua12
1 files changed, 12 insertions, 0 deletions
diff --git a/server-beta/src/parser/guide.lua b/server-beta/src/parser/guide.lua
index f8330438..f0634025 100644
--- a/server-beta/src/parser/guide.lua
+++ b/server-beta/src/parser/guide.lua
@@ -164,6 +164,18 @@ function m.getBreakBlock(obj)
error('guide.getBreakBlock overstack')
end
+--- 寻找根区块
+function m.getRoot(obj)
+ for _ = 1, 1000 do
+ local parent = obj.parent
+ if not parent then
+ return obj
+ end
+ obj = parent
+ end
+ error('guide.getRoot overstack')
+end
+
--- 寻找函数的不定参数,返回不定参在第几个参数上,以及该参数对象。
--- 如果函数是主函数,则返回`0, nil`。
---@return table