summaryrefslogtreecommitdiff
path: root/meta/template/coroutine.lua
blob: e84432db9e4641e65c49da5df0d944e65d6d74b1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
---@meta

---#DES 'coroutine'
---@class coroutine*
coroutine = {}

---#DES 'coroutine.create'
---@param f function
---@return thread
function coroutine.create(f) end

---#if VERSION >= 5.4 then
---#DES 'coroutine.isyieldable>5.4'
---@param co? thread
---@return boolean
function coroutine.isyieldable(co) end
---#else
---#DES 'coroutine.isyieldable'
---@return boolean
function coroutine.isyieldable() end
---#end

---@version >5.4
---#DES 'coroutine.close'
---@param co thread
---@return boolean noerror
---@return any errorobject
function coroutine.close(co) end

---#DES 'coroutine.resume'
---@param co    thread
---@param val1? any
---@return boolean success
---@return any result
---@return ...
function coroutine.resume(co, val1, ...) end

---#DES 'coroutine.running'
---@return thread running
---@return boolean ismain
function coroutine.running() end

---#DES 'coroutine.status'
---@param co thread
---@return
---| '"running"'   # ---#DESENUM 'costatus.running'
---| '"suspended"' # ---#DESENUM 'costatus.suspended'
---| '"normal"'    # ---#DESENUM 'costatus.normal'
---| '"dead"'      # ---#DESENUM 'costatus.dead'
function coroutine.status(co) end

---#DES 'coroutine.wrap'
---@param f function
---@return ...
function coroutine.wrap(f) end

---#DES 'coroutine.yield'
---@return ...
function coroutine.yield(...) end

return coroutine