Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions _internals/updating-lua-autogen.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Lua API docs

We semi-automatically generate the Lua API docs (`docs/lua/*`).

This happens through the following steps:

- run the Lua LSP JSON generator
- This is `https://github.com/LuaLS/lua-language-server`
- You'll need to clone the repo and build it (it will end up in `bin/lua-language-server`)
- From there, run something like

```
$ ./lua-language-server --doc=../../../quarto-dev/quarto-cli/src/resources/lua-types
```

there will be two files produced: doc.json and doc.md. Delete `doc.md` and move `doc.json` to `docs/lua` in this repository.

- run `quarto run tools/build-lua-types-autogen.ts`
123 changes: 123 additions & 0 deletions docs/lua/_coroutine.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
---
title: '`coroutine`'
---

```{=comment}
This is an autogenerated file. Do not edit it directly.
```


## `close`

```
function coroutine.close(co: thread)
-> noerror: boolean
2. errorobject: any
```


Closes coroutine `co` , closing all its pending to-be-closed variables and putting the coroutine in a dead state.

[View documents](command:extension.lua.doc?["en-us/54/manual.html/pdf-coroutine.close"])


## `create`

```
function coroutine.create(f: fun(...any):...unknown)
-> thread
```


Creates a new coroutine, with body `f`. `f` must be a function. Returns this new coroutine, an object with type `"thread"`.

[View documents](command:extension.lua.doc?["en-us/54/manual.html/pdf-coroutine.create"])


## `isyieldable`

```
function coroutine.isyieldable(co?: thread)
-> boolean
```


Returns true when the coroutine `co` can yield. The default for `co` is the running coroutine.

[View documents](command:extension.lua.doc?["en-us/54/manual.html/pdf-coroutine.isyieldable"])


## `resume`

```
function coroutine.resume(co: thread, val1?: any, ...any)
-> success: boolean
2. ...any
```


Starts or continues the execution of coroutine `co`.

[View documents](command:extension.lua.doc?["en-us/54/manual.html/pdf-coroutine.resume"])


## `running`

```
function coroutine.running()
-> running: thread
2. ismain: boolean
```


Returns the running coroutine plus a boolean, true when the running coroutine is the main one.

[View documents](command:extension.lua.doc?["en-us/54/manual.html/pdf-coroutine.running"])


## `status`

```
function coroutine.status(co: thread)
-> "dead"|"normal"|"running"|"suspended"
```


Returns the status of coroutine `co`.

[View documents](command:extension.lua.doc?["en-us/54/manual.html/pdf-coroutine.status"])


```lua
return #1:
| "running" -- Is running.
| "suspended" -- Is suspended or not started.
| "normal" -- Is active but not running.
| "dead" -- Has finished or stopped with an error.
```


## `wrap`

```
function coroutine.wrap(f: fun(...any):...unknown)
-> fun(...any):...unknown
```


Creates a new coroutine, with body `f`; `f` must be a function. Returns a function that resumes the coroutine each time it is called.

[View documents](command:extension.lua.doc?["en-us/54/manual.html/pdf-coroutine.wrap"])


## `yield`

```
(async) function coroutine.yield(...any)
-> ...any
```


Suspends the execution of the calling coroutine.

[View documents](command:extension.lua.doc?["en-us/54/manual.html/pdf-coroutine.yield"])
Loading
Loading