summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--server/libs/lua/coroutine.lni12
-rw-r--r--server/locale/en-US/libs/lua/coroutine.lni4
-rw-r--r--server/locale/zh-CN/libs/lua/coroutine.lni3
-rw-r--r--server/src/parser/ast.lua8
4 files changed, 27 insertions, 0 deletions
diff --git a/server/libs/lua/coroutine.lni b/server/libs/lua/coroutine.lni
index 51b717b9..be604cb8 100644
--- a/server/libs/lua/coroutine.lni
+++ b/server/libs/lua/coroutine.lni
@@ -31,6 +31,18 @@ type = 'thread'
[[.returns]]
type = 'boolean'
+[kill]
+version = 'Lua 5.4'
+[[.args]]
+name = 'co'
+type = 'thread'
+[[.returns]]
+name = 'noerror'
+type = 'boolean'
+`````````
+name = 'errorobject'
+type = 'any'
+
[resume]
[[.args]]
name = 'co'
diff --git a/server/locale/en-US/libs/lua/coroutine.lni b/server/locale/en-US/libs/lua/coroutine.lni
index 463288bc..ec06f21d 100644
--- a/server/locale/en-US/libs/lua/coroutine.lni
+++ b/server/locale/en-US/libs/lua/coroutine.lni
@@ -4,6 +4,10 @@ description = 'Creates a new coroutine.'
[isyieldable]
description = 'Returns true when the running coroutine can yield.'
+[kill]
+description = 'Kills coroutine `co` ,
+closing all its pending to-be-closed variables and putting the coroutine in a dead state.'
+
[resume]
description = 'Starts or continues the execution of coroutine `co`.'
diff --git a/server/locale/zh-CN/libs/lua/coroutine.lni b/server/locale/zh-CN/libs/lua/coroutine.lni
index e41b5e22..f2912c70 100644
--- a/server/locale/zh-CN/libs/lua/coroutine.lni
+++ b/server/locale/zh-CN/libs/lua/coroutine.lni
@@ -4,6 +4,9 @@ description = '创建一个主体函数为 `f` 的新协程。'
[isyieldable]
description = '如果正在运行的协程可以让出,则返回真。'
+[kill]
+description = '杀死协程 `co`,关闭它所有等待 *to-be-closed* 的变量,并将协程状态设为 `dead` 。'
+
[resume]
description = '开始或继续协程 `co` 的运行。'
diff --git a/server/src/parser/ast.lua b/server/src/parser/ast.lua
index a82e8d6e..6d401e44 100644
--- a/server/src/parser/ast.lua
+++ b/server/src/parser/ast.lua
@@ -295,6 +295,14 @@ local Defs = {
return string_char(tonumber(char, 16))
end,
CharUtf8 = function (pos, char)
+ if State.Version ~= 'Lua 5.3' and State.Version ~= 'Lua 5.4' then
+ pushError {
+ type = 'ERR_ESC',
+ start = pos-3,
+ finish = pos-2,
+ }
+ return char
+ end
if #char == 0 then
pushError {
type = 'UTF8_SMALL',