Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
6cfa226
mlua continuation yield
Jun 4, 2025
e01e45f
add missing xmove
Jun 4, 2025
bd6b65b
remove comment
Jun 4, 2025
c6f1ff2
add a f32 to test stack
Jun 4, 2025
875d6e8
cleanup
Jun 4, 2025
2a67b26
deal with warnings
Jun 4, 2025
d23f058
update warning
Jun 4, 2025
62330e7
allow yield on non-luau as well
Jun 4, 2025
1c7743c
fix
Jun 5, 2025
85416fd
Document continuations a bit more
Jun 5, 2025
b3a54ac
reuse same preallocatedfailure in both callback_error_ext and callbac…
Jun 5, 2025
085c62a
handle mainthread edgecase
Jun 5, 2025
198b857
fix import
Jun 5, 2025
2cd34db
support empty yield args
Jun 5, 2025
23b7705
add more tests for cont
Jun 5, 2025
dd3ea05
ensure check_stack of state
Jun 5, 2025
52176a8
rename to luau continuation status
Jun 6, 2025
10d2df4
add support for continuations outside luau
Jun 6, 2025
8400386
fix
Jun 6, 2025
5d86852
fix
Jun 6, 2025
9e77e5c
fix
Jun 6, 2025
eb63755
fix yieldable continuation on non-luau
Jun 6, 2025
9def001
fix luau compiler bug
Jun 6, 2025
e985f83
add note on why pop
Jun 6, 2025
3dcb131
fix docs which incorrectly state only luau supports yieldable continu…
Jun 6, 2025
3a079fe
make the api more ergonomic
Jun 6, 2025
3c005d7
rename set_yield_args to yield_with
Jun 6, 2025
c7ddbe6
partially revert due to compiler error
Jun 6, 2025
b44075f
fix
Jun 6, 2025
a2e8694
fix
Jun 6, 2025
4a37dc5
ensure wrappedfailure is returned to pool
Jun 6, 2025
a5c1ea1
fix wrap error case
Jun 6, 2025
3d52616
Fix doc warnings
khvzak Jun 6, 2025
541331c
begin adding auxthread code
Jun 7, 2025
cfc942d
fix more places
Jun 7, 2025
4174bdd
remove useless print calls
Jun 7, 2025
42c8d16
ensure compare_refs use right indices
Jun 7, 2025
a43b0db
fix indices again
Jun 7, 2025
dcd87c3
Update util.rs
cheesycod Jun 7, 2025
5d0a2d9
fix
Jun 8, 2025
3fb7abc
split out large thread create tests
Jun 8, 2025
4b8140b
add retest of continuation/yield across continuation
Jun 8, 2025
c68b990
fix partialeq
Jun 8, 2025
cbca60c
debug
Jun 8, 2025
c385453
fix index in create_thread
Jun 8, 2025
aee199f
remove
Jun 8, 2025
2e68555
fix thread
Jun 8, 2025
cd84332
optimize thread state args
Jun 10, 2025
707d551
Merge branch 'mlua-rs:main' into mlua-listofaux
cheesycod Jun 10, 2025
a46eae2
.
Jun 10, 2025
1f5f225
Merge branch 'mlua-rs:main' into threadopt
cheesycod Jun 10, 2025
223d49f
clean up
Jun 11, 2025
9bb1794
very slight perf optimization to status_inner
Jun 11, 2025
c4fadfd
expose try_cache
Jun 11, 2025
caeac2e
Add private app_data container for mlua internal use
khvzak Jun 11, 2025
a2dc662
Add RawLua::create_table_from (internal)
khvzak Jun 11, 2025
f002083
Bump lua-src
khvzak Jun 11, 2025
2fbbbe4
Fix minor grammar mistakes in README.md (#591)
steveRoll-git Jun 12, 2025
7bc72be
Use `serde` feature flag instead of `serialize`.
khvzak Jun 12, 2025
62f8482
Open some doc(hidden) functionality
khvzak Jun 12, 2025
7060753
fix tests
Jun 12, 2025
09b835e
Merge branch 'mlua-listofaux' into main
cheesycod Jun 12, 2025
d7e89cc
fix
Jun 12, 2025
1d19bee
Merge branch 'threadopt' into main
cheesycod Jun 12, 2025
52b410c
Merge pull request #2 from cheesycod/main
cheesycod Jun 12, 2025
bb85dfa
fix to use push_at vs push
Jun 12, 2025
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
26 changes: 13 additions & 13 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ jobs:
- name: Build ${{ matrix.lua }} vendored
run: |
cargo build --features "${{ matrix.lua }},vendored"
cargo build --features "${{ matrix.lua }},vendored,async,serialize,macros,anyhow,userdata-wrappers"
cargo build --features "${{ matrix.lua }},vendored,async,serialize,macros,anyhow,userdata-wrappers,send"
cargo build --features "${{ matrix.lua }},vendored,async,serde,macros,anyhow,userdata-wrappers"
cargo build --features "${{ matrix.lua }},vendored,async,serde,macros,anyhow,userdata-wrappers,send"
shell: bash
- name: Build ${{ matrix.lua }} pkg-config
if: ${{ matrix.os == 'ubuntu-latest' }}
Expand All @@ -51,7 +51,7 @@ jobs:
toolchain: stable
target: aarch64-apple-darwin
- name: Cross-compile
run: cargo build --target aarch64-apple-darwin --features "${{ matrix.lua }},vendored,async,send,serialize,macros,anyhow,userdata-wrappers"
run: cargo build --target aarch64-apple-darwin --features "${{ matrix.lua }},vendored,async,send,serde,macros,anyhow,userdata-wrappers"

build_aarch64_cross_ubuntu:
name: Cross-compile to aarch64-unknown-linux-gnu
Expand All @@ -72,7 +72,7 @@ jobs:
sudo apt-get install -y --no-install-recommends gcc-aarch64-linux-gnu libc6-dev-arm64-cross
shell: bash
- name: Cross-compile
run: cargo build --target aarch64-unknown-linux-gnu --features "${{ matrix.lua }},vendored,async,send,serialize,macros,anyhow,userdata-wrappers"
run: cargo build --target aarch64-unknown-linux-gnu --features "${{ matrix.lua }},vendored,async,send,serde,macros,anyhow,userdata-wrappers"
shell: bash

build_armv7_cross_ubuntu:
Expand All @@ -94,7 +94,7 @@ jobs:
sudo apt-get install -y --no-install-recommends gcc-arm-linux-gnueabihf libc-dev-armhf-cross
shell: bash
- name: Cross-compile
run: cargo build --target armv7-unknown-linux-gnueabihf --features "${{ matrix.lua }},vendored,async,send,serialize,macros,anyhow,userdata-wrappers"
run: cargo build --target armv7-unknown-linux-gnueabihf --features "${{ matrix.lua }},vendored,async,send,serde,macros,anyhow,userdata-wrappers"
shell: bash

test:
Expand Down Expand Up @@ -123,14 +123,14 @@ jobs:
- name: Run ${{ matrix.lua }} tests
run: |
cargo test --features "${{ matrix.lua }},vendored"
cargo test --features "${{ matrix.lua }},vendored,async,serialize,macros,anyhow,userdata-wrappers"
cargo test --features "${{ matrix.lua }},vendored,async,serialize,macros,anyhow,userdata-wrappers,send"
cargo test --features "${{ matrix.lua }},vendored,async,serde,macros,anyhow,userdata-wrappers"
cargo test --features "${{ matrix.lua }},vendored,async,serde,macros,anyhow,userdata-wrappers,send"
shell: bash
- name: Run compile tests (macos lua54)
if: ${{ matrix.os == 'macos-latest' && matrix.lua == 'lua54' }}
run: |
TRYBUILD=overwrite cargo test --features "${{ matrix.lua }},vendored" --tests -- --ignored
TRYBUILD=overwrite cargo test --features "${{ matrix.lua }},vendored,async,send,serialize,macros" --tests -- --ignored
TRYBUILD=overwrite cargo test --features "${{ matrix.lua }},vendored,async,send,serde,macros" --tests -- --ignored
shell: bash

test_with_sanitizer:
Expand All @@ -154,8 +154,8 @@ jobs:
- uses: Swatinem/rust-cache@v2
- name: Run ${{ matrix.lua }} tests with address sanitizer
run: |
cargo test --tests --features "${{ matrix.lua }},vendored,async,serialize,macros,anyhow" --target x86_64-unknown-linux-gnu -- --skip test_too_many_recursions
cargo test --tests --features "${{ matrix.lua }},vendored,async,serialize,macros,anyhow,userdata-wrappers,send" --target x86_64-unknown-linux-gnu -- --skip test_too_many_recursions
cargo test --tests --features "${{ matrix.lua }},vendored,async,serde,macros,anyhow" --target x86_64-unknown-linux-gnu -- --skip test_too_many_recursions
cargo test --tests --features "${{ matrix.lua }},vendored,async,serde,macros,anyhow,userdata-wrappers,send" --target x86_64-unknown-linux-gnu -- --skip test_too_many_recursions
shell: bash
env:
RUSTFLAGS: -Z sanitizer=address
Expand All @@ -181,7 +181,7 @@ jobs:
- uses: Swatinem/rust-cache@v2
- name: Run ${{ matrix.lua }} tests with forced memory limit
run: |
cargo test --tests --features "${{ matrix.lua }},vendored,async,send,serialize,macros,anyhow,userdata-wrappers"
cargo test --tests --features "${{ matrix.lua }},vendored,async,send,serde,macros,anyhow,userdata-wrappers"
shell: bash
env:
RUSTFLAGS: --cfg=force_memory_limit
Expand Down Expand Up @@ -254,7 +254,7 @@ jobs:
- name: Run ${{ matrix.lua }} tests
run: |
cargo test --tests --features "${{ matrix.lua }},vendored"
cargo test --tests --features "${{ matrix.lua }},vendored,async,serialize,macros,anyhow,userdata-wrappers"
cargo test --tests --features "${{ matrix.lua }},vendored,async,serde,macros,anyhow,userdata-wrappers"

rustfmt:
name: Rustfmt
Expand All @@ -281,4 +281,4 @@ jobs:
- uses: giraffate/clippy-action@v1
with:
reporter: 'github-pr-review'
clippy_flags: --features "${{ matrix.lua }},vendored,async,send,serialize,macros,anyhow,userdata-wrappers"
clippy_flags: --features "${{ matrix.lua }},vendored,async,send,serde,macros,anyhow,userdata-wrappers"
15 changes: 9 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ with async/await features and support of writing native Lua modules in Rust.
"""

[package.metadata.docs.rs]
features = ["lua54", "vendored", "async", "send", "serialize", "macros"]
features = ["lua54", "vendored", "async", "send", "serde", "macros"]
rustdoc-args = ["--cfg", "docsrs"]

[workspace]
Expand All @@ -40,11 +40,14 @@ module = ["mlua_derive", "ffi/module"]
async = ["dep:futures-util"]
send = ["error-send"]
error-send = []
serialize = ["dep:serde", "dep:erased-serde", "dep:serde-value", "bstr/serde"]
serde = ["dep:serde", "dep:erased-serde", "dep:serde-value", "bstr/serde"]
macros = ["mlua_derive/macros"]
anyhow = ["dep:anyhow", "error-send"]
userdata-wrappers = ["parking_lot/send_guard"]

# deprecated features
serialize = ["serde"]

[dependencies]
mlua_derive = { version = "=0.11.0-beta.2", optional = true, path = "mlua_derive" }
bstr = { version = "1.0", features = ["std"], default-features = false }
Expand Down Expand Up @@ -90,15 +93,15 @@ required-features = ["async"]
[[bench]]
name = "serde"
harness = false
required-features = ["serialize"]
required-features = ["serde"]

[[example]]
name = "async_http_client"
required-features = ["async", "macros"]

[[example]]
name = "async_http_reqwest"
required-features = ["async", "serialize", "macros"]
required-features = ["async", "serde", "macros"]

[[example]]
name = "async_http_server"
Expand All @@ -113,8 +116,8 @@ name = "guided_tour"
required-features = ["macros"]

[[example]]
name = "serialize"
required-features = ["serialize"]
name = "serde"
required-features = ["serde"]

[[example]]
name = "userdata"
Expand Down
72 changes: 36 additions & 36 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@
>
> See v0.10 [release notes](https://github.com/mlua-rs/mlua/blob/main/docs/release_notes/v0.10.md).

`mlua` is bindings to [Lua](https://www.lua.org) programming language for Rust with a goal to provide
_safe_ (as far as it's possible), high level, easy to use, practical and flexible API.
`mlua` is a set of bindings to the [Lua](https://www.lua.org) programming language for Rust with a goal to provide a
_safe_ (as much as possible), high level, easy to use, practical and flexible API.

Started as `rlua` fork, `mlua` supports Lua 5.4, 5.3, 5.2, 5.1 (including LuaJIT) and [Luau] and allows to write native Lua modules in Rust as well as use Lua in a standalone mode.
Started as an `rlua` fork, `mlua` supports Lua 5.4, 5.3, 5.2, 5.1 (including LuaJIT) and [Luau] and allows writing native Lua modules in Rust as well as using Lua in a standalone mode.

`mlua` tested on Windows/macOS/Linux including module mode in [GitHub Actions] on `x86_64` platform and cross-compilation to `aarch64` (other targets are also supported).
`mlua` is tested on Windows/macOS/Linux including module mode in [GitHub Actions] on `x86_64` platforms and cross-compilation to `aarch64` (other targets are also supported).

WebAssembly (WASM) is supported through `wasm32-unknown-emscripten` target for all Lua/Luau versions excluding JIT.

Expand All @@ -39,7 +39,7 @@ WebAssembly (WASM) is supported through `wasm32-unknown-emscripten` target for a

### Feature flags

`mlua` uses feature flags to reduce the amount of dependencies, compiled code and allow to choose only required set of features.
`mlua` uses feature flags to reduce the amount of dependencies and compiled code, and allow to choose only required set of features.
Below is a list of the available feature flags. By default `mlua` does not enable any features.

* `lua54`: enable Lua [5.4] support
Expand All @@ -51,12 +51,12 @@ Below is a list of the available feature flags. By default `mlua` does not enabl
* `luau`: enable [Luau] support (auto vendored mode)
* `luau-jit`: enable [Luau] support with JIT backend.
* `luau-vector4`: enable [Luau] support with 4-dimensional vector.
* `vendored`: build static Lua(JIT) library from sources during `mlua` compilation using [lua-src] or [luajit-src] crates
* `vendored`: build static Lua(JIT) libraries from sources during `mlua` compilation using [lua-src] or [luajit-src]
* `module`: enable module mode (building loadable `cdylib` library for Lua)
* `async`: enable async/await support (any executor can be used, eg. [tokio] or [async-std])
* `send`: make `mlua::Lua: Send + Sync` (adds [`Send`] requirement to `mlua::Function` and `mlua::UserData`)
* `error-send`: make `mlua:Error: Send + Sync`
* `serialize`: add serialization and deserialization support to `mlua` types using [serde] framework
* `serde`: add serialization and deserialization support to `mlua` types using [serde]
* `macros`: enable procedural macros (such as `chunk!`)
* `anyhow`: enable `anyhow::Error` conversion into Lua
* `userdata-wrappers`: opt into `impl UserData` for `Rc<T>`/`Arc<T>`/`Rc<RefCell<T>>`/`Arc<Mutex<T>>` where `T: UserData`
Expand All @@ -78,7 +78,7 @@ Below is a list of the available feature flags. By default `mlua` does not enabl

`mlua` supports async/await for all Lua versions including Luau.

This works using Lua [coroutines](https://www.lua.org/manual/5.3/manual.html#2.6) and require running [Thread](https://docs.rs/mlua/latest/mlua/struct.Thread.html) along with enabling `feature = "async"` in `Cargo.toml`.
This works using Lua [coroutines](https://www.lua.org/manual/5.3/manual.html#2.6) and requires running [Thread](https://docs.rs/mlua/latest/mlua/struct.Thread.html) along with enabling `feature = "async"` in `Cargo.toml`.

**Examples**:
- [HTTP Client](examples/async_http_client.rs)
Expand All @@ -93,7 +93,7 @@ This works using Lua [coroutines](https://www.lua.org/manual/5.3/manual.html#2.6
cargo run --example async_http_client --features=lua54,async,macros

# async http client (reqwest)
cargo run --example async_http_reqwest --features=lua54,async,macros,serialize
cargo run --example async_http_reqwest --features=lua54,async,macros,serde

# async http server
cargo run --example async_http_server --features=lua54,async,macros,send
Expand All @@ -102,7 +102,7 @@ curl -v http://localhost:3000

### Serialization (serde) support

With `serialize` feature flag enabled, `mlua` allows you to serialize/deserialize any type that implements [`serde::Serialize`] and [`serde::Deserialize`] into/from [`mlua::Value`]. In addition `mlua` provides [`serde::Serialize`] trait implementation for it (including `UserData` support).
With the `serde` feature flag enabled, `mlua` allows you to serialize/deserialize any type that implements [`serde::Serialize`] and [`serde::Deserialize`] into/from [`mlua::Value`]. In addition, `mlua` provides the [`serde::Serialize`] trait implementation for it (including `UserData` support).

[Example](examples/serialize.rs)

Expand All @@ -114,24 +114,24 @@ With `serialize` feature flag enabled, `mlua` allows you to serialize/deserializ

You have to enable one of the features: `lua54`, `lua53`, `lua52`, `lua51`, `luajit(52)` or `luau`, according to the chosen Lua version.

By default `mlua` uses `pkg-config` tool to find lua includes and libraries for the chosen Lua version.
In most cases it works as desired, although sometimes could be more preferable to use a custom lua library.
To achieve this, mlua supports `LUA_LIB`, `LUA_LIB_NAME` and `LUA_LINK` environment variables.
By default `mlua` uses `pkg-config` to find Lua includes and libraries for the chosen Lua version.
In most cases it works as desired, although sometimes it may be preferable to use a custom Lua library.
To achieve this, mlua supports the `LUA_LIB`, `LUA_LIB_NAME` and `LUA_LINK` environment variables.
`LUA_LINK` is optional and may be `dylib` (a dynamic library) or `static` (a static library, `.a` archive).

An example how to use them:
An example of how to use them:
``` sh
my_project $ LUA_LIB=$HOME/tmp/lua-5.2.4/src LUA_LIB_NAME=lua LUA_LINK=static cargo build
```

`mlua` also supports vendored lua/luajit using the auxiliary crates [lua-src](https://crates.io/crates/lua-src) and
`mlua` also supports vendored Lua/LuaJIT using the auxiliary crates [lua-src](https://crates.io/crates/lua-src) and
[luajit-src](https://crates.io/crates/luajit-src).
Just enable the `vendored` feature and cargo will automatically build and link specified lua/luajit version. This is the easiest way to get started with `mlua`.
Just enable the `vendored` feature and cargo will automatically build and link the specified Lua/LuaJIT version. This is the easiest way to get started with `mlua`.

### Standalone mode
In a standalone mode `mlua` allows to add to your application scripting support with a gently configured Lua runtime to ensure safety and soundness.
In standalone mode, `mlua` allows adding scripting support to your application with a gently configured Lua runtime to ensure safety and soundness.

Add to `Cargo.toml` :
Add to `Cargo.toml`:

``` toml
[dependencies]
Expand Down Expand Up @@ -159,11 +159,11 @@ fn main() -> LuaResult<()> {
```

### Module mode
In a module mode `mlua` allows to create a compiled Lua module that can be loaded from Lua code using [`require`](https://www.lua.org/manual/5.4/manual.html#pdf-require). In this case `mlua` uses an external Lua runtime which could lead to potential unsafety due to unpredictability of the Lua environment and usage of libraries such as [`debug`](https://www.lua.org/manual/5.4/manual.html#6.10).
In module mode, `mlua` allows creating a compiled Lua module that can be loaded from Lua code using [`require`](https://www.lua.org/manual/5.4/manual.html#pdf-require). In this case `mlua` uses an external Lua runtime which could lead to potential unsafety due to the unpredictability of the Lua environment and usage of libraries such as [`debug`](https://www.lua.org/manual/5.4/manual.html#6.10).

[Example](examples/module)

Add to `Cargo.toml` :
Add to `Cargo.toml`:

``` toml
[lib]
Expand All @@ -173,7 +173,7 @@ crate-type = ["cdylib"]
mlua = { version = "0.10", features = ["lua54", "module"] }
```

`lib.rs` :
`lib.rs`:

``` rust
use mlua::prelude::*;
Expand Down Expand Up @@ -216,14 +216,14 @@ rustflags = [
```
On Linux you can build modules normally with `cargo build --release`.

On Windows the target module will be linked with `lua5x.dll` library (depending on your feature flags).
On Windows the target module will be linked with the `lua5x.dll` library (depending on your feature flags).
Your main application should provide this library.

Module builds don't require Lua lib or headers to be installed on the system.
Module builds don't require Lua binaries or headers to be installed on the system.

### Publishing to luarocks.org

There is a LuaRocks build backend for mlua modules [`luarocks-build-rust-mlua`].
There is a LuaRocks build backend for mlua modules: [`luarocks-build-rust-mlua`].

Modules written in Rust and published to luarocks:
- [`decasify`](https://github.com/alerque/decasify)
Expand All @@ -236,19 +236,19 @@ Modules written in Rust and published to luarocks:

## Safety

One of the `mlua` goals is to provide *safe* API between Rust and Lua.
Every place where the Lua C API may trigger an error longjmp in any way is protected by `lua_pcall`,
and the user of the library is protected from directly interacting with unsafe things like the Lua stack,
and there is overhead associated with this safety.
One of `mlua`'s goals is to provide a *safe* API between Rust and Lua.
Every place where the Lua C API may trigger an error longjmp is protected by `lua_pcall`,
and the user of the library is protected from directly interacting with unsafe things like the Lua stack.
There is overhead associated with this safety.

Unfortunately, `mlua` does not provide absolute safety even without using `unsafe` .
This library contains a huge amount of unsafe code. There are almost certainly bugs still lurking in this library!
It is surprisingly, fiendishly difficult to use the Lua C API without the potential for unsafety.

## Panic handling

`mlua` wraps panics that are generated inside Rust callbacks in a regular Lua error. Panics could be
resumed then by returning or propagating the Lua error to Rust code.
`mlua` wraps panics that are generated inside Rust callbacks in a regular Lua error. Panics can then be
resumed by returning or propagating the Lua error to Rust code.

For example:
``` rust
Expand All @@ -267,12 +267,12 @@ let _ = lua.load(r#"
unreachable!()
```

Optionally `mlua` can disable Rust panics catching in Lua via `pcall`/`xpcall` and automatically resume
Optionally, `mlua` can disable Rust panic catching in Lua via `pcall`/`xpcall` and automatically resume
them across the Lua API boundary. This is controlled via `LuaOptions` and done by wrapping the Lua `pcall`/`xpcall`
functions on a way to prevent catching errors that are wrapped Rust panics.
functions to prevent catching errors that are wrapped Rust panics.

`mlua` should also be panic safe in another way as well, which is that any `Lua` instances or handles
remains usable after a user generated panic, and such panics should not break internal invariants or
remain usable after a user generated panic, and such panics should not break internal invariants or
leak Lua stack space. This is mostly important to safely use `mlua` types in Drop impls, as you should not be
using panics for general error handling.

Expand All @@ -289,12 +289,12 @@ If you encounter them, a bug report would be very welcome:

## Sandboxing

Please check the [Luau Sandboxing] page if you are interested in running untrusted Lua scripts in controlled environment.
Please check the [Luau Sandboxing] page if you are interested in running untrusted Lua scripts in a controlled environment.

`mlua` provides `Lua::sandbox` method for enabling sandbox mode (Luau only).
`mlua` provides the `Lua::sandbox` method for enabling sandbox mode (Luau only).

[Luau Sandboxing]: https://luau.org/sandbox

## License

This project is licensed under the [MIT license](LICENSE)
This project is licensed under the [MIT license](LICENSE).
File renamed without changes.
2 changes: 1 addition & 1 deletion mlua-sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ module = []
cc = "1.0"
cfg-if = "1.0"
pkg-config = "0.3.17"
lua-src = { version = ">= 548.0.0, < 548.1.0", optional = true }
lua-src = { version = ">= 548.1.0, < 548.2.0", optional = true }
luajit-src = { version = ">= 210.6.0, < 210.7.0", optional = true }
luau0-src = { version = "0.15.0", optional = true }

Expand Down
5 changes: 5 additions & 0 deletions mlua-sys/src/lua52/lua.rs
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,11 @@ pub unsafe fn lua_yield(L: *mut lua_State, n: c_int) -> c_int {
lua_yieldk(L, n, 0, None)
}

#[inline(always)]
pub unsafe fn lua_yieldc(L: *mut lua_State, n: c_int, k: lua_CFunction) -> c_int {
lua_yieldk(L, n, 0, Some(k))
}

//
// Garbage-collection function and options
//
Expand Down
5 changes: 5 additions & 0 deletions mlua-sys/src/lua53/lua.rs
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,11 @@ pub unsafe fn lua_yield(L: *mut lua_State, n: c_int) -> c_int {
lua_yieldk(L, n, 0, None)
}

#[inline(always)]
pub unsafe fn lua_yieldc(L: *mut lua_State, n: c_int, k: lua_KFunction) -> c_int {
lua_yieldk(L, n, 0, Some(k))
}

//
// Garbage-collection function and options
//
Expand Down
Loading