1837 Commits

Author SHA1 Message Date
Alex Orlenko 2e7c654cfe Make AsChunk trait dyn-friendly 2025-05-26 23:29:59 +01:00
Alex Orlenko f36aaa5ce1 Add loadstring function to Luau
Closes #578
2025-05-15 11:10:42 +01:00
Alex Orlenko df38878278 Update __mlua_index/__mlua_newindex chunk names 2025-05-15 11:03:30 +01:00
Alex Orlenko c5c1fe3b85 Fix tests 2025-05-14 00:19:29 +01:00
Alex Orlenko 0cc4b15f6b Generate doc for lua_module macro using doc cfg instead of docsrs 2025-05-13 21:56:11 +01:00
Alex Orlenko f16aca687d Terminate underlying Rust future when AsyncThread is dropped.
Before this change, Lua GC was responsible to collect and destroy the future if
`AsyncThread` dropped in yielded state.
Now we will propagate "drop" event immediately so Lua GC need to only free the memory.
2025-05-09 12:48:40 +01:00
Alex Orlenko 9b45663afd v0.11.0-beta.1 v0.11.0-beta.1 2025-05-06 23:25:26 +01:00
Alex Orlenko c0c802262e Add must_use to AsyncCallFuture 2025-05-06 22:48:48 +01:00
Alex Orlenko dda344bfc6 Rename _typos.toml to typos.toml 2025-05-06 22:42:19 +01:00
Alex Orlenko 93adfa42d1 Update doc comments 2025-05-06 22:36:23 +01:00
Alex Orlenko 5dc6c3214b Prepare for 2024 edition 2025-05-06 21:28:21 +01:00
Alex Orlenko da08f7210f Revert disabling "module" feature flag for Luau in mlua-sys
Dynamic linking should still be okay
2025-05-06 15:48:52 +01:00
Alex Orlenko 8b7a85076a mlua-sys: Prepare to 2024 edition 2025-05-06 15:47:14 +01:00
Alex Orlenko a4ff68a120 v0.10.4 2025-05-06 15:47:09 +01:00
Alex Orlenko 5454cfa5ed mlua-sys: v0.7.0 2025-05-06 15:46:35 +01:00
Alex Orlenko f9d9dc74a7 Update CHANGELOG 2025-05-06 15:46:29 +01:00
Alex Orlenko ed796fff51 Support async require loaders for Luau 2025-05-04 11:00:59 +01:00
Alex Orlenko 65e5be81ba Update __mlua_async_poll chunk name 2025-05-04 11:00:27 +01:00
Alex Orlenko 4fa8e645b7 Fix Luau "require" tests 2025-05-03 21:45:39 +01:00
Alex Orlenko 05a0abb8c2 Replace Requite::load with Require::loader 2025-05-03 18:00:02 +01:00
Alex Orlenko f0c0527c2b Update Lua* dependencies 2025-05-03 17:58:33 +01:00
Alex Orlenko 2490dfeb38 Silence clippy false positives 2025-05-01 13:18:40 +01:00
Alex Orlenko 4a3dbafb6e Update scoped userdata mismatch tests 2025-05-01 13:12:00 +01:00
Alex Orlenko 97ca3e2c08 Check that type passed to scoped userdata self argument is userdata.
If passed type is non-userdata we try to get a pointer (which will be null) that triggers an assertion.
Having a check also allow us to generate right error message.
Fixes #569
2025-05-01 13:09:23 +01:00
Alex Orlenko d6fb328660 Don't use Lua::get_or_init_from_ptr in Require::load wrapper 2025-04-28 10:07:11 +01:00
Alex Orlenko edd508ed1f Make StateGuard automatically enabled inside callback_error_ext.
Remove manual usage of `StateGuard` in other places.
Closes #567
2025-04-27 23:09:20 +01:00
Alex Orlenko a30a736291 Don't borrow mutably appdata container when working with require content cache 2025-04-27 00:38:30 +01:00
Alex Orlenko 8e1df48e81 Add encode_empty_tables_as_array serialize option.
This will change the behaviour of encoding empty Lua tables into array instead of map.
2025-04-26 17:53:56 +01:00
Alex Orlenko efd192b816 Optimize Table::is_empty 2025-04-26 15:37:12 +01:00
krakow10 5e1451a465 Fix Reversed Comments & Typo (#560)
* Fix reversed comments

* Fix typos
2025-04-26 13:49:50 +01:00
Alex Orlenko 64b1d152b9 Deprecate Lua::load_from_finction and replace it with Lua::register_module and Lua::preload_module instead. 2025-04-26 13:42:07 +01:00
Alex Orlenko a8a4aa8c93 Switch to "proxyrequire" function (follow up Luau 0.671) 2025-04-25 23:41:11 +01:00
Alex Orlenko 9fda2ecfcc mlua-sys: Update Luau to 0.671 2025-04-25 23:38:49 +01:00
Alex Orlenko 21fc924457 Add Lua::create_require_function method 2025-04-25 20:01:37 +01:00
Alex Orlenko 30d5e08a8a Add MaybeSend to Require trait 2025-04-25 15:51:33 +01:00
Alex Orlenko 560a30ca02 Support new Luau require system
This commit introduces the `Require` trait that be used to change `require` behaviour.
By default mlua implements behaviour same as `ReplRequirer` in the original Luau.
Unfortunately binary Luau modules are no longer supported by the new system.
2025-04-25 14:19:41 +01:00
Alex Orlenko 117f8377e2 mlua-sys: Add definitions for Luau require library (since 0.669) 2025-04-20 21:44:16 +02:00
Alex Orlenko 8173ef2fa8 Update README 2025-04-06 17:51:54 +01:00
Alex Orlenko 4e5677ae54 Update references to mlua repo 2025-04-06 15:37:38 +01:00
Alex Orlenko 49958f4827 Split Luau thread event callback to creation and collection callbacks.
We need this because they have different requirements:
- Thread creation callback can return Error or panic
- Thread collection callback runs during Luau GC cycle and cannot make any Lua calls or trigger panics.
2025-04-06 13:57:15 +01:00
Alex Orlenko 39b3af2ff2 Fix warnings when testing documentation 2025-04-05 23:44:25 +01:00
Alex Orlenko b805939320 Make Lua::weak() method and WeakLua struct public.
This can be useful to prevent circular dependencies between Rust and Lua
or check that Lua instance is still alive.
2025-04-05 23:40:05 +01:00
Alex Orlenko bd13300288 Update dependencies 2025-04-05 18:30:22 +01:00
Alex Orlenko 12e61e01f6 Restrict access to Luau VM from UserData destructors.
It's unsafe to make almost any Lua calls when userdata destructor is running.
This can cause recursive GC run and crash.
See https://github.com/luau-lang/luau/pull/510 for some details.
2025-04-05 10:31:39 +01:00
Alex Orlenko 53ff494ab9 Prepare for custom (Luau) userdata destructors.
We need to add logic later to prevent calling any Lua functions when UserData destructor is running.
2025-04-04 16:36:06 +01:00
Alex Orlenko 1cb081d20a Do not propagate collect_garbage flag when clonning Lua 2025-04-04 10:58:08 +01:00
Alex Orlenko c1a018a60d Add AnyUserData::type_id method 2025-03-31 22:41:42 +01:00
Alex Orlenko 4d2ff45a8b Update Lua::poll_pending doc (still hidden) 2025-03-31 22:26:47 +01:00
Alex Orlenko 72682198eb Bump Luau to 0.667 2025-03-30 11:12:14 +01:00
Alex Orlenko 87fa663ac1 Remove deprecated functions 2025-03-28 13:24:15 +00:00