Skip to content

Commit 7def61a

Browse files
committed
Merge branch 'v0.10' into for/crank
2 parents dbfbc25 + 31efd0c commit 7def61a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+2382
-1253
lines changed

.github/workflows/main.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,8 @@ jobs:
129129
- name: Run compile tests (macos lua54)
130130
if: ${{ matrix.os == 'macos-latest' && matrix.lua == 'lua54' }}
131131
run: |
132-
TRYBUILD=overwrite cargo test --features "${{ matrix.lua }},vendored" -- --ignored
133-
TRYBUILD=overwrite cargo test --features "${{ matrix.lua }},vendored,async,send,serialize,macros" -- --ignored
132+
TRYBUILD=overwrite cargo test --features "${{ matrix.lua }},vendored" --tests -- --ignored
133+
TRYBUILD=overwrite cargo test --features "${{ matrix.lua }},vendored,async,send,serialize,macros" --tests -- --ignored
134134
shell: bash
135135

136136
test_with_sanitizer:

CHANGELOG.md

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,29 @@
1-
## v0.10.2 (Jan 27th, 2025)
1+
## v0.10.5 (May 24th, 2025)
2+
3+
- mlua-sys is back to 0.6.x (Luau 0.663)
4+
- Reverted: Trigger abort when Luau userdata destructors are panic (requires new mlua-sys)
5+
- Reverted: Added large (52bit) integers support for Luau (breaking change)
6+
7+
## v0.10.4 (May 5th, 2025)
8+
9+
_yanked_ because of semver-breaking changes
10+
11+
- Luau updated to 0.672
12+
- New serde option `encode_empty_tables_as_array` to serialize empty tables as arrays
13+
- Added `WeakLua` and `Lua::weak()` to create weak references to Lua state
14+
- Trigger abort when Luau userdata destructors are panic (Luau GC does not support it)
15+
- Added `AnyUserData::type_id()` method to get the type id of the userdata
16+
- Added `Chunk::name()`, `Chunk::environment()` and `Chunk::mode()` functions
17+
- Support borrowing underlying wrapped types for `UserDataRef` and `UserDataRefMut` (under `userdata-wrappers` feature)
18+
- Added large (52bit) integers support for Luau
19+
- Enable `serde` for `bstr` if `serialize` feature flag is enabled
20+
- Recursive warnings (Lua 5.4) are no longer allowed
21+
- Implemented `IntoLua`/`FromLua` for `BorrowedString` and `BorrowedBytes`
22+
- Implemented `IntoLua`/`FromLua` for `char`
23+
- Enable `Thread::reset()` for all Lua versions (limited support for 5.1-5.3)
24+
- Bugfixes and improvements
25+
26+
## v0.10.3 (Jan 27th, 2025)
227

328
- Set `Default` for `Value` to be `Nil`
429
- Allow exhaustive match on `Value` (#502)
@@ -304,7 +329,7 @@ Other:
304329

305330
## v0.8.0
306331
Changes since 0.7.4
307-
- Roblox Luau support
332+
- Luau support
308333
- Removed C glue
309334
- Added async support to `__index` and `__newindex` metamethods
310335
- Added `Function::info()` to get information about functions (#149).
@@ -354,7 +379,7 @@ Breaking changes:
354379

355380
## v0.8.0-beta.1
356381

357-
- Roblox Luau support
382+
- Luau support
358383
- Refactored ffi module. C glue is no longer required
359384
- Added async support to `__index` and `__newindex` metamethods
360385

@@ -467,7 +492,7 @@ Breaking changes:
467492
- [**Breaking**] Removed `AnyUserData::has_metamethod()`
468493
- Added `Thread::reset()` for luajit/lua54 to recycle threads.
469494
It's possible to attach a new function to a thread (coroutine).
470-
- Added `chunk!` macro support to load chunks of Lua code using the Rust tokenizer and optinally capturing Rust variables.
495+
- Added `chunk!` macro support to load chunks of Lua code using the Rust tokenizer and optionally capturing Rust variables.
471496
- Improved error reporting (`Error`'s `__tostring` method formats full stacktraces). This is useful in the module mode.
472497

473498
## v0.6.0-beta.1
@@ -523,7 +548,7 @@ Breaking changes:
523548

524549
- Lua 5.4 support with `MetaMethod::Close`.
525550
- `lua53` feature is disabled by default. Now preferred Lua version have to be chosen explicitly.
526-
- Provide safety guaraness for Lua state, which means that potenially unsafe operations, like loading C modules (using `require` or `package.loadlib`) are disabled. Equalient for the previous `Lua::new()` function is `Lua::unsafe_new()`.
551+
- Provide safety guarantees for Lua state, which means that potentially unsafe operations, like loading C modules (using `require` or `package.loadlib`) are disabled. Equivalent to the previous `Lua::new()` function is `Lua::unsafe_new()`.
527552
- New `send` feature to require `Send`.
528553
- New `module` feature, that disables linking to Lua Core Libraries. Required for modules.
529554
- Don't allow `'callback` outlive `'lua` in `Lua::create_function()` to fix [the unsoundness](tests/compile/static_callback_args.rs).

Cargo.toml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
[package]
22
name = "mlua"
3-
version = "0.10.3" # remember to update mlua_derive
3+
version = "0.10.5" # remember to update mlua_derive
44
authors = ["Aleksandr Orlenko <zxteam@pm.me>", "kyren <catherine@kyju.org>"]
55
rust-version = "1.79.0"
66
edition = "2021"
7-
repository = "https://github.com/khvzak/mlua"
7+
repository = "https://github.com/mlua-rs/mlua"
88
documentation = "https://docs.rs/mlua"
99
readme = "README.md"
1010
keywords = ["lua", "luajit", "luau", "async", "scripting"]
1111
categories = ["api-bindings", "asynchronous"]
1212
license = "MIT"
1313
description = """
14-
High level bindings to Lua 5.4/5.3/5.2/5.1 (including LuaJIT) and Roblox Luau
14+
High level bindings to Lua 5.4/5.3/5.2/5.1 (including LuaJIT) and Luau
1515
with async/await features and support of writing native Lua modules in Rust.
1616
"""
1717

@@ -36,11 +36,11 @@ luau = ["ffi/luau", "dep:libloading"]
3636
luau-jit = ["luau", "ffi/luau-codegen"]
3737
luau-vector4 = ["luau", "ffi/luau-vector4"]
3838
vendored = ["ffi/vendored"]
39-
module = ["dep:mlua_derive", "ffi/module"]
39+
module = ["mlua_derive", "ffi/module"]
4040
async = ["dep:futures-util"]
4141
send = ["parking_lot/send_guard", "error-send"]
4242
error-send = []
43-
serialize = ["dep:serde", "dep:erased-serde", "dep:serde-value"]
43+
serialize = ["dep:serde", "dep:erased-serde", "dep:serde-value", "bstr/serde"]
4444
macros = ["mlua_derive/macros"]
4545
anyhow = ["dep:anyhow", "error-send"]
4646
userdata-wrappers = []
@@ -57,8 +57,9 @@ erased-serde = { version = "0.4", optional = true }
5757
serde-value = { version = "0.7", optional = true }
5858
parking_lot = { version = "0.12", features = ["arc_lock"] }
5959
anyhow = { version = "1.0", optional = true }
60+
rustversion = "1.0"
6061

61-
ffi = { package = "mlua-sys", version = "0.6.6", path = "mlua-sys" }
62+
ffi = { package = "mlua-sys", version = "0.6.8", path = "mlua-sys" }
6263

6364
[target.'cfg(unix)'.dependencies]
6465
libloading = { version = "0.8", optional = true }
@@ -78,7 +79,7 @@ static_assertions = "1.0"
7879

7980
[target.'cfg(not(target_arch = "wasm32"))'.dev-dependencies]
8081
criterion = { version = "0.5", features = ["async_tokio"] }
81-
rustyline = "14.0"
82+
rustyline = "15.0"
8283
tokio = { version = "1.0", features = ["full"] }
8384

8485
[lints.rust]

README.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# mlua
22
[![Build Status]][github-actions] [![Latest Version]][crates.io] [![API Documentation]][docs.rs] [![Coverage Status]][codecov.io] ![MSRV]
33

4-
[Build Status]: https://github.com/khvzak/mlua/workflows/CI/badge.svg
5-
[github-actions]: https://github.com/khvzak/mlua/actions
4+
[Build Status]: https://github.com/mlua-rs/mlua/workflows/CI/badge.svg
5+
[github-actions]: https://github.com/mlua-rs/mlua/actions
66
[Latest Version]: https://img.shields.io/crates/v/mlua.svg
77
[crates.io]: https://crates.io/crates/mlua
88
[API Documentation]: https://docs.rs/mlua/badge.svg
@@ -19,19 +19,19 @@
1919

2020
> **Note**
2121
>
22-
> See v0.10 [release notes](https://github.com/khvzak/mlua/blob/main/docs/release_notes/v0.10.md).
22+
> See v0.10 [release notes](https://github.com/mlua-rs/mlua/blob/main/docs/release_notes/v0.10.md).
2323
2424
`mlua` is bindings to [Lua](https://www.lua.org) programming language for Rust with a goal to provide
2525
_safe_ (as far as it's possible), high level, easy to use, practical and flexible API.
2626

27-
Started as `rlua` fork, `mlua` supports Lua 5.4, 5.3, 5.2, 5.1 (including LuaJIT) and [Roblox Luau] and allows to write native Lua modules in Rust as well as use Lua in a standalone mode.
27+
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.
2828

2929
`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).
3030

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

33-
[GitHub Actions]: https://github.com/khvzak/mlua/actions
34-
[Roblox Luau]: https://luau.org
33+
[GitHub Actions]: https://github.com/mlua-rs/mlua/actions
34+
[Luau]: https://luau.org
3535

3636
## Usage
3737

@@ -64,9 +64,9 @@ Below is a list of the available feature flags. By default `mlua` does not enabl
6464
[5.2]: https://www.lua.org/manual/5.2/manual.html
6565
[5.1]: https://www.lua.org/manual/5.1/manual.html
6666
[LuaJIT]: https://luajit.org/
67-
[Luau]: https://github.com/Roblox/luau
68-
[lua-src]: https://github.com/khvzak/lua-src-rs
69-
[luajit-src]: https://github.com/khvzak/luajit-src-rs
67+
[Luau]: https://github.com/luau-lang/luau
68+
[lua-src]: https://github.com/mlua-rs/lua-src-rs
69+
[luajit-src]: https://github.com/mlua-rs/luajit-src-rs
7070
[tokio]: https://github.com/tokio-rs/tokio
7171
[async-std]: https://github.com/async-rs/async-std
7272
[`Send`]: https://doc.rust-lang.org/std/marker/trait.Send.html

docs/release_notes/v0.10.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
The v0.10 version of mlua has goal to improve the user experience while keeping the same performance and safety guarantees.
44
This document highlights the most notable features. For a full list of changes, see the [CHANGELOG].
55

6-
[CHANGELOG]: https://github.com/khvzak/mlua/blob/main/CHANGELOG.md
6+
[CHANGELOG]: https://github.com/mlua-rs/mlua/blob/main/CHANGELOG.md
77

88
### New features
99

docs/release_notes/v0.9.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
The v0.9 version of mlua is a major release that includes a number of API changes and improvements. This release is a stepping stone towards the v1.0.
44
This document highlights the most important changes. For a full list of changes, see the [CHANGELOG].
55

6-
[CHANGELOG]: https://github.com/khvzak/mlua/blob/main/CHANGELOG.md
6+
[CHANGELOG]: https://github.com/mlua-rs/mlua/blob/main/CHANGELOG.md
77

88
### New features
99

@@ -304,7 +304,7 @@ assert_eq!(f.call::<_, mlua::String>(())?, "hello");
304304

305305
The new mlua version has a number of performance improvements. Please check the [benchmarks results] to see how mlua compares to rlua and rhai.
306306

307-
[benchmarks results]: https://github.com/khvzak/script-bench-rs
307+
[benchmarks results]: https://github.com/mlua-rs/script-bench-rs
308308

309309
### Changes in `module` mode
310310

mlua-sys/Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
[package]
22
name = "mlua-sys"
3-
version = "0.6.7"
3+
version = "0.6.8"
44
authors = ["Aleksandr Orlenko <zxteam@pm.me>"]
55
rust-version = "1.71"
66
edition = "2021"
7-
repository = "https://github.com/khvzak/mlua"
7+
repository = "https://github.com/mlua-rs/mlua"
88
documentation = "https://docs.rs/mlua-sys"
99
readme = "README.md"
1010
categories = ["external-ffi-bindings"]
1111
license = "MIT"
1212
links = "lua"
1313
build = "build/main.rs"
1414
description = """
15-
Low level (FFI) bindings to Lua 5.4/5.3/5.2/5.1 (including LuaJIT) and Roblox Luau
15+
Low level (FFI) bindings to Lua 5.4/5.3/5.2/5.1 (including LuaJIT) and Luau
1616
"""
1717

1818
[package.metadata.docs.rs]

mlua-sys/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# mlua-sys
22

3-
Low level (FFI) bindings to Lua 5.4/5.3/5.2/5.1 (including LuaJIT) and Roblox [Luau].
3+
Low level (FFI) bindings to Lua 5.4/5.3/5.2/5.1 (including LuaJIT) and [Luau].
44

55
Intended to be consumed by the [mlua] crate.
66

7-
[Luau]: https://github.com/Roblox/luau
7+
[Luau]: https://github.com/luau-lang/luau
88
[mlua]: https://crates.io/crates/mlua

mlua-sys/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//! Low level bindings to Lua 5.4/5.3/5.2/5.1 (including LuaJIT) and Roblox Luau.
1+
//! Low level bindings to Lua 5.4/5.3/5.2/5.1 (including LuaJIT) and Luau.
22
33
#![allow(non_camel_case_types, non_snake_case, dead_code)]
44
#![allow(clippy::missing_safety_doc)]

mlua-sys/src/lua51/compat.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -548,7 +548,7 @@ pub unsafe fn luaL_getsubtable(L: *mut lua_State, idx: c_int, fname: *const c_ch
548548

549549
pub unsafe fn luaL_requiref(L: *mut lua_State, modname: *const c_char, openf: lua_CFunction, glb: c_int) {
550550
luaL_checkstack(L, 3, cstr!("not enough stack slots available"));
551-
luaL_getsubtable(L, LUA_REGISTRYINDEX, cstr!("_LOADED"));
551+
luaL_getsubtable(L, LUA_REGISTRYINDEX, LUA_LOADED_TABLE);
552552
if lua_getfield(L, -1, modname) == LUA_TNIL {
553553
lua_pop(L, 1);
554554
lua_pushcfunction(L, openf);

0 commit comments

Comments
 (0)