-
使用 require 函数会享受到模块名的补全,而且支持跳转到模块。但是现在我使用 xpcall 包装了 require: ---@param modname string
---@return any
_G.load_module = function(modname)
local ok, module = xpcall(require, debug.traceback, modname)
if ok then
if module == nil then
return true
end
return module
end
print('模块 ' .. modname .. ' 加载失败')
print(module)
return nil
end 那么我怎样才能让函数 load_module 享受到类似 require 一样的待遇呢? 我看源码中似乎这部分是写死的,只有函数 require 才能这样吗》 |
Beta Was this translation helpful? Give feedback.
Answered by
sumneko
Apr 8, 2022
Replies: 1 comment 1 reply
-
修改设置 |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
cathaysia
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
修改设置
Lua.runtime.special