summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsumneko <sumneko@hotmail.com>2019-04-03 18:34:36 +0800
committersumneko <sumneko@hotmail.com>2019-04-03 18:34:36 +0800
commitb311bf5b0332518b8c9870d90557ca09eb19ee26 (patch)
treeceaefc5a601243b1b17e036e4bc9de2fe78c2922
parent10aafe270e4a3de3595c002676fc559b78ea3106 (diff)
downloadlua-language-server-b311bf5b0332518b8c9870d90557ca09eb19ee26.zip
生下的Lua 5.4 API
-rw-r--r--server/libs/lua/math.lni13
-rw-r--r--server/libs/lua/string.lni24
-rw-r--r--server/locale/en-US/libs/lua/math.lni14
-rw-r--r--server/locale/en-US/libs/lua/string.lni11
4 files changed, 62 insertions, 0 deletions
diff --git a/server/libs/lua/math.lni b/server/libs/lua/math.lni
index 6458ccf4..cd24c094 100644
--- a/server/libs/lua/math.lni
+++ b/server/libs/lua/math.lni
@@ -172,6 +172,19 @@ type = 'number'
name = 'x'
type = 'integer'
+["randomseed Lua 5.4"]
+name = 'randomseed'
+version = 'Lua 5.4'
+[[.args]]
+name = 'x'
+type = 'integer'
+optional = 'after'
+``````````
+name = 'y'
+type = 'integer'
+optional = 'after'
+default = 0
+
[sin]
[[.args]]
name = 'x'
diff --git a/server/libs/lua/string.lni b/server/libs/lua/string.lni
index d1754b74..a45be1d1 100644
--- a/server/libs/lua/string.lni
+++ b/server/libs/lua/string.lni
@@ -111,6 +111,30 @@ returns = {
},
}
+["gmatch Lua 5.4"]
+name = 'gmatch'
+version = 'Lua 5.4'
+[[.args]]
+type = 'string'
+``````````
+name = 'pattern'
+type = 'string'
+``````````
+name = 'init'
+type = 'integer'
+optional = 'after'
+default = 1
+[[.returns]]
+type = 'function'
+returns = {
+ 1 = {
+ type = 'string'
+ },
+ 2 = {
+ type = '...'
+ },
+}
+
[gsub]
[[.args]]
type = 'string'
diff --git a/server/locale/en-US/libs/lua/math.lni b/server/locale/en-US/libs/lua/math.lni
index 1a5ca814..e5bc33b3 100644
--- a/server/locale/en-US/libs/lua/math.lni
+++ b/server/locale/en-US/libs/lua/math.lni
@@ -65,6 +65,20 @@ description = [[
[randomseed]
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.
+]]
+
[sin]
description = 'Returns the sine of `x` (assumed to be in radians).'
diff --git a/server/locale/en-US/libs/lua/string.lni b/server/locale/en-US/libs/lua/string.lni
index 633afdf8..3c7b987d 100644
--- a/server/locale/en-US/libs/lua/string.lni
+++ b/server/locale/en-US/libs/lua/string.lni
@@ -24,6 +24,17 @@ end
```
]]
+["gmatch Lua 5.4"]
+description = [[
+----------
+```lua
+s = "hello world from Lua"
+for w in string.gmatch(s, "%a+") do
+ print(w)
+end
+```
+]]
+
[gsub]
description = 'Returns a copy of s in which all (or the first `n`, if given) occurrences of the [`pattern`](https://www.lua.org/manual/5.3/manual.html#6.4.1) have been replaced by a replacement string specified by `repl`.'