summaryrefslogtreecommitdiff
path: root/meta/template/coroutine.lua
blob: 013b883fbdebc4907398fb118334afe5f81c810b (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
---@meta

---@class coroutine
coroutine = {}

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

---@param co thread?
---@return boolean
function coroutine.isyieldable(co) end

---@param co thread
---@return boolean noerror
---@return any errorobject
function coroutine.close(co) end

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

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

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

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

---@return ...
function coroutine.yield(...) end

return coroutine