Commit Graph

1909 Commits

Author SHA1 Message Date
Alex Orlenko b7c98ad9bb mlua_derive: Switch from #[userdata] to [derive(UserData)] 2026-05-30 13:11:26 +01:00
Alex Orlenko 1f3dafa564 mlua_derive: Reject static field functions with args 2026-05-30 12:46:31 +01:00
Alex Orlenko 1d4a756436 mlua_derive: Support async userdata methods in macro 2026-05-29 00:56:33 +01:00
Alex Orlenko 6e7d6c78ed mlua_derive: Group functionality in modules
Create new `chunk`, `userdata`, `module` modules.
2026-05-26 23:23:09 +01:00
Alex Orlenko 023e4c61d8 mlua_derive: Fix compilation / remove "if let" guards 2026-05-26 23:23:09 +01:00
Alex Orlenko 92bd06d3c1 mlua_derive: Refactor Capture implementation for chunk! 2026-05-26 23:23:09 +01:00
Alex Orlenko d8544bf038 mlua_derive: Optimize Captures::add 2026-05-26 23:23:09 +01:00
Alex Orlenko 7114c03489 mlua_derive: Remove unneeded Span::line hack for chunk! since we use Rust 1.95+ 2026-05-26 23:23:09 +01:00
Alex Orlenko f4cacc524e mlua_derive: Bump MSRV to 1.88 2026-05-26 23:23:09 +01:00
Alex Orlenko cc7f7ce7b7 mlua_derive: show better error message when $ is not followed by ident 2026-05-26 23:23:09 +01:00
Alex Orlenko 72de602ec3 Fix modules compilation after switching to 2024 edition in mlua_derive 2026-05-26 23:23:09 +01:00
Alex Orlenko 1573dd1242 Add #[mlua::userdata] and #[mlua::userdata_impl] macros 2026-05-26 23:23:09 +01:00
Alex Orlenko 39d3201848 Prevent XRc overflow when dropping RawLua with foreign Lua state
Calling `lua_close` triggers GC collection of the `ExtraData` that
cascades to `RawLua::drop` where extra is already decremented to 0,
causing a subtraction overflow.
2026-05-26 23:18:24 +01:00
莯凛 4aa6214b45 feat: implement Not for StdLib (#699) 2026-04-30 22:56:50 +01:00
Alex Orlenko 72824a468a Remove custom PartialEq for LuaString and use derived one
Lua can compare strings using `lua_rawequal` and it's more efficient
than always compare bytes.
Under the hood Lua compare pointers for interned strings and content for long ones.
Close #694
2026-04-22 22:30:45 +01:00
Alex Orlenko c54b90623c Fix String::to_pointer return NULL in Lua <5.4
Lua 5.4+ can return string pointer when calling `lua_topointer`.
In earlier Lua versions this API always returns NULL.
Let's unify this behavior.
2026-04-22 22:23:25 +01:00
Alex Orlenko 5f0e06fb66 Update CHANGELOG v0.12.0-rc.1 2026-04-22 00:06:11 +01:00
Alex Orlenko 181c9d07b7 v0.12.0-rc.1 2026-04-20 00:24:58 +01:00
Alex Orlenko 4e827179d1 Update compile tests messages 2026-04-20 00:19:56 +01:00
Alex Orlenko cc26dcd4ff Bump rustyline 2026-04-20 00:16:34 +01:00
Alex Orlenko 201e30bc07 Add UserDataOwned<T> wrapper to take ownership of userdata T
It implements `FromLua` and takes ownership of a Lua userdata value.
The semantics is similar to `AnyUserData::take`, preventing any
further use from Lua.

Closes #686
2026-04-20 00:05:57 +01:00
Alex Orlenko 4e028d8409 Change AnyUserData::type_name to return LuaString instead.
This avoids unnecessary allocation and returns type name as it stored in metatable.
2026-04-19 23:26:24 +01:00
Alex Orlenko 3d1ae981d3 Update docs 2026-04-19 22:12:17 +01:00
Alex Orlenko 8c93948f2f Fix tests 2026-04-18 16:13:23 +01:00
Alex Orlenko f2b5cc44de traits module no longer need to be public
The LuaNativeFn traits were moved to the `function` module and all other traits
as re-exported.
2026-04-18 16:09:17 +01:00
Alex Orlenko 27f91dfd1b Accept any error in Function::wrap/wrap_mut/wrap_async
Previously wrapped functions were required to return `mlua::Result`.
Now it's possible to wrap functions returning any errors as long as
they implement `std::error::Error`.

Existing code remains compatible with `mlua::Result` as this type
is not converted to an external error.
2026-04-18 16:01:35 +01:00
Alex Orlenko 75ff11f795 Move LuaNativeFn/Mut into function module 2026-04-18 14:56:24 +01:00
Alex Orlenko df6097ab38 Mark Luau CompileConstant as non_exhaustive 2026-04-18 14:51:54 +01:00
Alex Orlenko 65bb6279ee Update serde types visibility 2026-04-18 14:47:26 +01:00
Alex Orlenko 31b88e85bb cargo fmt 2026-04-18 13:26:42 +01:00
Alex Orlenko 3be4745190 Add initial Luau integer64 type support
RFC: https://rfcs.luau.org/type-long-integer.html
Unfortunately this type is not backward compatible with regular numbers
and require a special "integer" library.
It's not integrated with `Value` enum to keep it simple.
2026-04-18 13:14:05 +01:00
Alex Orlenko c52deec988 Use c_int for userdata metatable id 2026-04-18 13:14:05 +01:00
三咲雅 misaki masa 3ab3c997b3 feat: support external strings for Cow<str> and Cow<CStr> (#692) 2026-04-09 10:45:15 +01:00
Alex Orlenko 5872ed70f5 Make traits module public 2026-04-04 15:04:00 +01:00
Alex Orlenko e7e92b4f6f Make chunk module public 2026-04-03 13:58:05 +01:00
Alex Orlenko d27693b61a Make error module public 2026-03-29 10:26:45 +01:00
Alex Orlenko c9848d6faf Update doc/example for (hidden) Lua::exec_raw_lua 2026-03-28 23:57:35 +00:00
Alex Orlenko 9126bb8ce0 Add RawLua::pop method 2026-03-28 22:37:25 +00:00
Alex Orlenko 7f1d716a44 Remove deprecated Lua::load_from_function 2026-03-28 17:40:22 +00:00
Alex Orlenko be56e2205c Update GC step_size doc 2026-03-28 17:38:49 +00:00
Alex Orlenko c5aadc68cd Open UserDataMethods::add_method_once and UserDataMethods::add_async_method_once 2026-03-28 17:17:57 +00:00
Alex Orlenko a5ae2a1fc3 Update useratom doc 2026-03-28 17:07:03 +00:00
Alex Orlenko 59872da63d mlua-sys: Bump lua-src and luajit-src dependencies 2026-03-28 16:31:19 +00:00
Alex Orlenko a24d2151af Minor fixes in docs 2026-03-27 22:54:56 +00:00
Alex Orlenko 56c227fd7e Make state module public 2026-03-08 00:06:18 +00:00
Alex Orlenko d5d66abe42 Refactor GC control API
- Replace `gc_inc/gc_gen` with `gc_set_mode`
- Add `GcIncParams` and `GcGenParams` for GC tuning
- Remove `gc_step_kbytes` (it's very rare needed and Lua 5.5 has changed the input param from kbytes to bytes)
2026-03-07 23:52:10 +00:00
Alex Orlenko a2d8b21964 Make luau module public 2026-03-01 16:40:19 +00:00
Alex Orlenko a9604c4946 Rename Luau's TextRequirer to FsRequirer 2026-03-01 16:27:41 +00:00
Alex Orlenko 81ae8e1393 Make Chunk::wrap public 2026-03-01 16:17:11 +00:00
Alex Orlenko a959b98d30 Add chunk module doc and update prelude re-exports 2026-03-01 16:11:38 +00:00