diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2019-04-05 12:26:44 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2019-04-05 12:26:44 +0800 |
commit | 4f94d3500d6d7b6d082647359011d2ca103741db (patch) | |
tree | 10ab0e987ba03431aacbf0e6f0bebfdeb1d0f456 | |
parent | da00d824100381c52a81b9e6f1d824e6b344755d (diff) | |
download | lua-language-server-4f94d3500d6d7b6d082647359011d2ca103741db.zip |
一些API更新与翻译
-rw-r--r-- | server/libs/lua/io.lni | 70 | ||||
-rw-r--r-- | server/libs/lua/math.lni | 61 | ||||
-rw-r--r-- | server/libs/lua/string.lni | 3 | ||||
-rw-r--r-- | server/locale/en-US/libs/lua/io.lni | 57 | ||||
-rw-r--r-- | server/locale/en-US/libs/lua/math.lni | 33 | ||||
-rw-r--r-- | server/locale/zh-CN/libs/lua/basic.lni | 45 | ||||
-rw-r--r-- | server/locale/zh-CN/libs/lua/debug.lni | 7 | ||||
-rw-r--r-- | server/locale/zh-CN/libs/lua/io.lni | 57 | ||||
-rw-r--r-- | server/locale/zh-CN/libs/lua/math.lni | 27 |
9 files changed, 341 insertions, 19 deletions
diff --git a/server/libs/lua/io.lni b/server/libs/lua/io.lni index 94e62ae9..bf59969f 100644 --- a/server/libs/lua/io.lni +++ b/server/libs/lua/io.lni @@ -61,7 +61,44 @@ optional = 'self' type = 'FILE*' optional = 'self' -[lines] +["lines Lua 5.1"] +name = 'lines' +version = {'Lua 5.1', 'Lua 5.2'} +[[.args]] +name = 'filename' +type = 'string' +optional = 'after' +`````````` +name = 'mode' +type = '...' +[[.returns]] +type = 'function' +returns = { + 1 = { + name = 'c', + type = {'string', 'number'}, + } +} +[[.enums]] +name = 'mode' +enum = '*n' +`````````` +name = 'mode' +enum = '*a' +`````````` +name = 'mode' +enum = '*l' +default = true +`````````` +name = 'mode' +enum = '*L' +`````````` +name = 'mode' +code = 'number' + +["lines Lua 5.3"] +name = 'lines' +version = {'Lua 5.3', 'Lua 5.4'} [[.args]] name = 'filename' type = 'string' @@ -147,7 +184,36 @@ default = true name = 'mode' enum = 'w' -[read] +["read Lua 5.1"] +name = 'read' +version = {'Lua 5.3', 'Lua 5.4'} +[[.args]] +name = 'mode' +type = '...' +[[.returns]] +type = {'string', 'number'} +`````````` +type = '...' +[[.enums]] +name = 'mode' +enum = '*n' +`````````` +name = 'mode' +enum = '*a' +`````````` +name = 'mode' +enum = '*l' +default = true +`````````` +name = 'mode' +enum = '*L' +`````````` +name = 'mode' +code = 'number' + +["read Lua 5.3"] +name = 'read' +version = {'Lua 5.3', 'Lua 5.4'} [[.args]] name = 'mode' type = '...' diff --git a/server/libs/lua/math.lni b/server/libs/lua/math.lni index cd24c094..4098d29e 100644 --- a/server/libs/lua/math.lni +++ b/server/libs/lua/math.lni @@ -40,7 +40,31 @@ type = 'number' [[.returns]] type = 'number' -[atan] +["atan Lua 5.1"] +name = 'atan' +version = {'Lua 5.1', 'Lua 5.2'} +[[.args]] +name = 'y' +type = 'number' +[[.returns]] +type = 'number' + +["atan Lua 5.3"] +name = 'atan' +version = {'Lua 5.3', 'Lua 5.4'} +[[.args]] +name = 'y' +type = 'number' +`````````` +name = 'x' +type = 'number' +optional = 'self' +default = 1 +[[.returns]] +type = 'number' + +[atan2] +version = {'Lua 5.1', 'Lua 5.2'} [[.args]] name = 'y' type = 'number' @@ -66,6 +90,14 @@ type = 'number' [[.returns]] type = 'number' +[cosh] +version = {'Lua 5.1', 'Lua 5.2'} +[[.args]] +name = 'x' +type = 'number' +[[.returns]] +type = 'number' + [deg] [[.args]] name = 'x' @@ -148,6 +180,17 @@ type = 'number' [pi] type = 'number' +[power] +version = {'Lua 5.1', 'Lua 5.2'} +[[.args]] +name = 'x' +type = 'number' +`````````` +name = 'y' +type = 'number' +[[.returns]] +type = 'number' + [rad] [[.args]] name = 'x' @@ -192,6 +235,14 @@ type = 'number' [[.returns]] type = 'number' +[sinh] +version = {'Lua 5.1', 'Lua 5.2'} +[[.args]] +name = 'x' +type = 'number' +[[.returns]] +type = 'number' + [sqrt] [[.args]] name = 'x' @@ -206,6 +257,14 @@ type = 'number' [[.returns]] type = 'number' +[tanh] +version = {'Lua 5.1', 'Lua 5.2'} +[[.args]] +name = 'x' +type = 'number' +[[.returns]] +type = 'number' + [tointeger] [[.args]] name = 'x' diff --git a/server/libs/lua/string.lni b/server/libs/lua/string.lni index a45be1d1..bd454fc0 100644 --- a/server/libs/lua/string.lni +++ b/server/libs/lua/string.lni @@ -181,6 +181,7 @@ name = 'captured' type = 'string' [pack] +version = {'Lua 5.3', 'Lua 5.4'} [[.args]] name = 'fmt' type = 'string' @@ -197,6 +198,7 @@ name = 'binary' type = 'string' [packsize] +version = {'Lua 5.3', 'Lua 5.4'} [[.args]] name = 'fmt' type = 'string' @@ -238,6 +240,7 @@ default = -1 type = 'string' [unpack] +version = {'Lua 5.3', 'Lua 5.4'} [[.args]] name = 'fmt' type = 'string' diff --git a/server/locale/en-US/libs/lua/io.lni b/server/locale/en-US/libs/lua/io.lni index 14122cea..6b25495f 100644 --- a/server/locale/en-US/libs/lua/io.lni +++ b/server/locale/en-US/libs/lua/io.lni @@ -16,7 +16,37 @@ description = 'Saves any written data to default output file.' [input] description = 'Sets `file` as the default input file.' -[lines] +["lines Lua 5.1"] +description = [[ +------ +```lua +for c in io.lines(filename, ...) do + body +end +``` +]] +[[.enums]] +name = 'mode' +enum = '*n' +description = 'Reads a numeral and returns it as number.' +`````````` +name = 'mode' +enum = '*a' +description = 'Reads the whole file.' +`````````` +name = 'mode' +enum = '*l' +description = 'Reads the next line skipping the end of line.' +`````````` +name = 'mode' +enum = '*L' +description = 'Reads the next line keeping the end of line.' +`````````` +name = 'mode' +code = 'number' +description = 'Reads a string with up to this number of bytes.' + +["lines Lua 5.3"] description = [[ ------ ```lua @@ -87,7 +117,30 @@ name = 'mode' enum = 'w' description = 'Write data to this program by `file`.' -[read] +["read Lua 5.1"] +description = 'Reads the `file`, according to the given formats, which specify what to read.' +[[.enums]] +name = 'mode' +enum = '*n' +description = 'Reads a numeral and returns it as number.' +`````````` +name = 'mode' +enum = '*a' +description = 'Reads the whole file.' +`````````` +name = 'mode' +enum = '*l' +description = 'Reads the next line skipping the end of line.' +`````````` +name = 'mode' +enum = '*L' +description = 'Reads the next line keeping the end of line.' +`````````` +name = 'mode' +code = 'number' +description = 'Reads a string with up to this number of bytes.' + +["read Lua 5.3"] description = 'Reads the `file`, according to the given formats, which specify what to read.' [[.enums]] name = 'mode' diff --git a/server/locale/en-US/libs/lua/math.lni b/server/locale/en-US/libs/lua/math.lni index e5bc33b3..c731511b 100644 --- a/server/locale/en-US/libs/lua/math.lni +++ b/server/locale/en-US/libs/lua/math.lni @@ -7,7 +7,13 @@ description = 'Returns the arc cosine of `x` (in radians).' [asin] description = 'Returns the arc sine of `x` (in radians).' -[atan] +["atan Lua 5.1"] +description = 'Returns the arc tangent of `x` (in radians).' + +["atan Lua 5.3"] +description = 'Returns the arc tangent of `y/x` (in radians).' + +[atan2] description = 'Returns the arc tangent of `y/x` (in radians).' [ceil] @@ -16,6 +22,9 @@ description = 'Returns the smallest integral value larger than or equal to `x`.' [cos] description = 'Returns the cosine of `x` (assumed to be in radians).' +[cosh] +description = 'Returns the hyperbolic cosine of `x` (assumed to be in radians).' + [deg] description = 'Converts the angle `x` from radians to degrees.' @@ -52,6 +61,9 @@ description = 'Returns the integral part of `x` and the fractional part of `x`.' [pi] description = 'The value of *π*.' +[power] +description = 'Returns `x ^ y` .' + [rad] description = 'Converts the angle `x` from degrees to radians.' @@ -67,27 +79,26 @@ description = 'Sets `x` as the "seed" for the pseudo-random generator.' ["randomseed Lua 5.4"] description = [[ -When called with at least one argument, -the integer parameters `x` and `y` are -concatenated into a 128-bit `seed` that -is used to reinitialize the pseudo-random generator; -equal seeds produce equal sequences of numbers. -The default for `y` is zero. - -When called with no arguments, -Lua generates a seed with -a weak attempt for randomness. +* `math.randomseed(x, y)`: Concatenate `x` and `y` into a 128-bit `seed` to reinitialize the pseudo-random generator. +* `math.randomseed(x)`: Equate to `math.randomseed(x, 0)` . +* `math.randomseed()`: Generates a seed with a weak attempt for randomness. ]] [sin] description = 'Returns the sine of `x` (assumed to be in radians).' +[sinh] +description = 'Returns the hyperbolic sine of `x` (assumed to be in radians).' + [sqrt] description = 'Returns the square root of `x`.' [tan] description = 'Returns the tangent of `x` (assumed to be in radians).' +[tanh] +description = 'Returns the hyperbolic tangent of `x` (assumed to be in radians).' + [tointeger] description = 'If the value `x` is convertible to an integer, returns that integer.' diff --git a/server/locale/zh-CN/libs/lua/basic.lni b/server/locale/zh-CN/libs/lua/basic.lni index 40b6bd6c..8d6c25a6 100644 --- a/server/locale/zh-CN/libs/lua/basic.lni +++ b/server/locale/zh-CN/libs/lua/basic.lni @@ -38,6 +38,48 @@ name = 'opt' enum = 'isrunning' description = '返回表示收集器是否在工作的布尔值。' +["collectgarbage Lua 5.4"] +[[.enums]] +name = 'opt' +enum = 'collect' +description = '做一次完整的垃圾收集循环。' +`````````` +name = 'opt' +enum = 'stop' +description = '停止垃圾收集器的运行。' +`````````` +name = 'opt' +enum = 'restart' +description = '重启垃圾收集器的自动运行。' +`````````` +name = 'opt' +enum = 'count' +description = '以 K 字节数为单位返回 Lua 使用的总内存数。' +`````````` +name = 'opt' +enum = 'step' +description = '单步运行垃圾收集器。' +`````````` +name = 'opt' +enum = 'setpause' +description = '设置收集器的 `间歇率`。' +`````````` +name = 'opt' +enum = 'setstepmul' +description = '设置收集器的 `步进倍率`。' +`````````` +name = 'opt' +enum = 'incremental' +description = '改变收集器模式为增量模式。' +`````````` +name = 'opt' +enum = 'generational' +description = '改变收集器模式为分代模式。' +`````````` +name = 'opt' +enum = 'isrunning' +description = '返回表示收集器是否在工作的布尔值。' + [dofile] description = '打开该名字的文件,并执行文件中的 Lua 代码块。' @@ -155,6 +197,9 @@ description = '当前解释器版本号。' ["_VERSION Lua 5.4"] description = '当前解释器版本号。' +[warn] +description = '以给定消息发出一个警告。当`tocont`为 true 时,应当继续调用该函数来接续消息。`tocont`的默认值为 false 。' + [xpcall] description = '传入参数并设置一个消息处理器 `msgh`,以 *保护模式* 调用函数 `f` 。' diff --git a/server/locale/zh-CN/libs/lua/debug.lni b/server/locale/zh-CN/libs/lua/debug.lni index a3e3e6ad..6aa9bd07 100644 --- a/server/locale/zh-CN/libs/lua/debug.lni +++ b/server/locale/zh-CN/libs/lua/debug.lni @@ -50,6 +50,9 @@ description = '返回函数 `f` 的第 `up` 个上值的名字和值。' [getuservalue] description = '返回关联在 `u` 上的 `Lua` 值。' +["getuservalue Lua 5.4"] +description = '返回关联在 `u` 上的第 `n` 个 `Lua` 值,以及一个布尔,`false`表示值不存在。' + [sethook] description = '将一个函数作为钩子函数设入。' [[.enums]] @@ -74,6 +77,10 @@ description = '将 `value` 的元表设为 `table` (可以是 `nil`)。' [setupvalue] description = '将 `value` 设为函数 `f` 的第 `up` 个上值。' +["setuservalue Lua 5.4"] +description = '将 `value` 设为 `udata` 的第 `n` 个关联值。' +值。' + [setuservalue] description = '将 `value` 设为 `udata` 的关联值。' diff --git a/server/locale/zh-CN/libs/lua/io.lni b/server/locale/zh-CN/libs/lua/io.lni index a35fa0ae..4a8a72a0 100644 --- a/server/locale/zh-CN/libs/lua/io.lni +++ b/server/locale/zh-CN/libs/lua/io.lni @@ -16,7 +16,37 @@ description = '将写入的数据保存到默认输出文件中。' [input] description = '设置 `file` 为默认输入文件。' -[lines] +["lines Lua 5.1"] +description = [[ +------ +```lua +for c in io.lines(filename, ...) do + body +end +``` +]] +[[.enums]] +name = 'mode' +enum = '*n' +description = '读取一个数字,根据 Lua 的转换文法返回浮点数或整数。' +`````````` +name = 'mode' +enum = '*a' +description = '从当前位置开始读取整个文件。' +`````````` +name = 'mode' +enum = '*l' +description = '读取一行并忽略行结束标记。' +`````````` +name = 'mode' +enum = '*L' +description = '读取一行并保留行结束标记。' +`````````` +name = 'mode' +code = 'number' +description = '读取一个不超过这个数量字节数的字符串。' + +["lines Lua 5.3"] description = [[ ------ ```lua @@ -87,7 +117,30 @@ name = 'mode' enum = 'w' description = '向这个程序写入输入。' -[read] +["read Lua 5.1"] +description = '读文件 `file`, 指定的格式决定了要读什么。' +[[.enums]] +name = 'mode' +enum = '*n' +description = '读取一个数字,根据 Lua 的转换文法返回浮点数或整数。' +`````````` +name = 'mode' +enum = '*a' +description = '从当前位置开始读取整个文件。' +`````````` +name = 'mode' +enum = '*l' +description = '读取一行并忽略行结束标记。' +`````````` +name = 'mode' +enum = '*L' +description = '读取一行并保留行结束标记。' +`````````` +name = 'mode' +code = 'number' +description = '读取一个不超过这个数量字节数的字符串。' + +["read Lua 5.3"] description = '读文件 `file`, 指定的格式决定了要读什么。' [[.enums]] name = 'mode' diff --git a/server/locale/zh-CN/libs/lua/math.lni b/server/locale/zh-CN/libs/lua/math.lni index 0bee3bb4..1377918c 100644 --- a/server/locale/zh-CN/libs/lua/math.lni +++ b/server/locale/zh-CN/libs/lua/math.lni @@ -7,7 +7,13 @@ description = '返回 `x` 的反余弦值(用弧度表示)。' [asin] description = '返回 `x` 的反正弦值(用弧度表示)。' -[atan] +["atan Lua 5.1"] +description = '返回 `x` 的反正切值(用弧度表示)。' + +["atan Lua 5.3"] +description = '返回 `y/x` 的反正切值(用弧度表示)。' + +[atan2] description = '返回 `y/x` 的反正切值(用弧度表示)。' [ceil] @@ -16,6 +22,9 @@ description = '返回不小于 `x` 的最小整数值。' [cos] description = '返回 `x` 的余弦(假定参数是弧度)。' +[cosh] +description = '返回 `x` 的双曲余弦(假定参数是弧度)。' + [deg] description = '将角 `x` 从弧度转换为角度。' @@ -52,6 +61,9 @@ description = '返回 `x` 的整数部分和小数部分。' [pi] description = '*π* 的值。' +[power] +description = '返回 `x ^ y` 。' + [rad] description = '将角 `x` 从角度转换为弧度。' @@ -65,15 +77,28 @@ description = [[ [randomseed] description = '把 `x` 设为伪随机数发生器的“种子”: 相同的种子产生相同的随机数列。' +["randomseed Lua 5.4"] +description = [[ +* `math.randomseed(x, y)`: 将 `x` 与 `y` 连接为128位的种子来重新初始化伪随机生成器。 +* `math.randomseed(x)`: 等同于 `math.randomseed(x, 0)` 。 +* `math.randomseed()`: Generates a seed with a weak attempt for randomness. +]] + [sin] description = '返回 `x` 的正弦值(假定参数是弧度)。' +[sinh] +description = '返回 `x` 的双曲正弦值(假定参数是弧度)。' + [sqrt] description = '返回 `x` 的平方根。' [tan] description = '返回 `x` 的正切值(假定参数是弧度)。' +[tanh] +description = '返回 `x` 的双曲正切值(假定参数是弧度)。' + [tointeger] description = '如果 `x` 可以转换为一个整数, 返回该整数。' |