diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2020-11-20 16:31:21 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2020-11-20 16:31:21 +0800 |
commit | 57e4aa220078222cde843af7ebaea4b839a6cec3 (patch) | |
tree | 6999f87ae5c3f75353508a968687cc4d2625effa | |
parent | 798e296e3fe7f726c83cfba9017893da86bdd5ce (diff) | |
download | lua-language-server-57e4aa220078222cde843af7ebaea4b839a6cec3.zip |
some fixs
-rw-r--r-- | locale/en-US/meta.lni | 2 | ||||
-rw-r--r-- | locale/zh-CN/meta.lni | 2 | ||||
-rw-r--r-- | meta/template/package.lua | 12 |
3 files changed, 12 insertions, 4 deletions
diff --git a/locale/en-US/meta.lni b/locale/en-US/meta.lni index fafbff92..ea92c21e 100644 --- a/locale/en-US/meta.lni +++ b/locale/en-US/meta.lni @@ -337,6 +337,8 @@ os = '' "os.tmpname" = Returns a string with a file name that can be used for a temporary file. package = '' +"require<5.3" = Loads the given module, returns any value returned by the given module(`true` when `nil`). +"require>5.4" = Loads the given module, returns any value returned by the searcher(`true` when `nil`). Besides that value, also returns as a second result the loader data returned by the searcher, which indicates how `require` found the module. (For instance, if the module came from a file, this loader data is the file path.) "package.config" = A string describing some compile-time configurations for packages. "package.cpath" = The path used by `require` to search for a C loader. "package.loaded" = A table used by `require` to control which modules are already loaded. diff --git a/locale/zh-CN/meta.lni b/locale/zh-CN/meta.lni index 063066a2..0d7c4a56 100644 --- a/locale/zh-CN/meta.lni +++ b/locale/zh-CN/meta.lni @@ -315,6 +315,8 @@ os = '' "os.tmpname" = 返回一个可用于临时文件的文件名字符串。 package = '' +"require<5.3" = 加载一个模块,返回该模块的返回值(`nil`时为`true`)。 +"require>5.4" = 加载一个模块,返回该模块的返回值(`nil`时为`true`)与搜索器返回的加载数据。默认搜索器的加载数据指示了加载位置,对于文件来说就是文件路径。 "package.config" = 一个描述有一些为包管理准备的编译期配置信息的串。 "package.cpath" = 这个路径被 `require` 在 C 加载器中做搜索时用到。 "package.loaded" = 用于 `require` 控制哪些模块已经被加载的表。 diff --git a/meta/template/package.lua b/meta/template/package.lua index d7c1d262..600a2f4c 100644 --- a/meta/template/package.lua +++ b/meta/template/package.lua @@ -1,12 +1,17 @@ ---@meta ----#DES 'require' +---#if VERSION >=5.4 then +---#DES 'require>5.4' ---@param modname string ---@return any ----#if VERSION >=5.4 then ---@return any loaderdata ----#end function require(modname) end +---#else +---#DES 'require<5.3' +---@param modname string +---@return any +function require(modname) end +---#end ---#DES 'package' ---@class package* @@ -15,7 +20,6 @@ function require(modname) end ---@field loaded table ---@field path string ---@field preload table ----#end package = {} ---@version <5.1 |