Alex Orlenko
c8436e2b80
Make function module public
...
Reduce number of function-specific types exported to the mlua root and keep
them inside the module.
2026-01-30 13:18:05 +00:00
Alex Orlenko
c79b5e9cdb
cargo fmt
2026-01-29 23:03:56 +00:00
Alex Orlenko
2ace892613
Rename string::String to LuaString
2026-01-29 18:45:41 +00:00
Alex Orlenko
d9c139b55f
Rust 2024
2026-01-29 10:33:28 +00:00
Alex Orlenko
7fb7e8685f
Update spelling check
2026-01-23 15:37:18 +00:00
Alex Orlenko
93617eef4e
Update trybuild (compile) messages
2026-01-23 15:16:35 +00:00
Alex Orlenko
171cdf1758
Some fixes and more tests for Function::info
2026-01-23 12:44:22 +00:00
Alex Orlenko
86d0c9bddb
More multi borrow "send" test fixes due to regression in Rust 1.93+
2026-01-22 23:08:17 +00:00
Alex Orlenko
e33bcf7938
Add Lua 5.5 external string null byte test
2026-01-22 15:32:14 +00:00
Alex Orlenko
c80a97b526
Ignore userdata_multithread_access_sync test
2026-01-22 15:25:18 +00:00
Alex Orlenko
b1f99aa852
Update tests
2026-01-17 13:26:13 +00:00
Alex Orlenko
e1701b6b56
cargo fmt
2026-01-14 15:57:52 +00:00
Alex Orlenko
77d7d5d6bd
Add initial Lua 5.5 support
2026-01-13 23:43:31 +00:00
psentee
ee9232eda1
AnyUserData::is_proxy ( #666 )
2026-01-13 15:08:38 +00:00
Alex Orlenko
2e4184e7e4
Update spelling
2025-11-22 13:49:23 +00:00
Alex Orlenko
121971f54e
Add Lua::set_memory_category and Lua::heap_dump functions to profile Luau memory usage.
...
This functionality uses Luau private api to dump heap mempory in JSON format for inspection.
The new type `HeapDump` represents memory snapshot with some basic API to calculate stats.
2025-11-22 00:01:34 +00:00
Alex Orlenko
a2728928cf
Temporary disable some send tests on nightly
...
Aparently there is a regression in the compiler and sync detection does not work correctly
2025-11-18 00:51:24 +00:00
Alex Orlenko
0beaac228c
Update Luau require tests
2025-11-16 23:51:51 +00:00
Alex Orlenko
0611906c6a
Add Lua::type_metatable helper to get metatable of a primitive type.
...
The accompany function `Lua::set_type_metatable` already exists.
2025-11-05 22:07:14 +00:00
Alex Orlenko
0619f264de
Add Lua::traceback function to generate stack traces at different levels
...
This is similar to `debug.traceback`, through does not require debug module.
Close #652
2025-10-28 14:49:22 +00:00
Alex Orlenko
1152519074
Add add_method_once and add_async_method_once UserData methods (experimental).
...
They will allow implementing userdata methods that can be called only once, destructing
userdata instance during the call.
2025-10-26 20:14:46 +00:00
Alex Orlenko
a4c8b20697
impl IntoLuaMulti for &MultiValue
2025-10-13 12:36:42 +01:00
Alex Crichton
6e353d6c9f
Build/test wasm32-wasip2 in CI ( #649 )
...
This is a follow-up from mlua-rs/lua-src-rs#13 which verifies/tests that
mlua/lua all work when compiled for a WASI target. While this doesn't
have formal documentation yet it also codifies in CI configuration how
to build for WASI and get tests passing (notably C compiler
configuration and some misc Rust flags).
This moves some `dev-dependencies` that don't compile for
`wasm32-wasip2` to a different section of the manifest. This
additionally annotates panicking tests with `#[cfg(not(panic =
"abort"))]` to skip those tests on WASI.
This does not test either the `send` or `async` feature at this time.
Testing `send` requires threads which WASI does not yet support, and
testing `async` requires more support in Tokio which is not currently
there yet.
2025-10-04 09:52:23 +01:00
Alex Orlenko
2beca6ebe1
Add test for Table::for_each_value
2025-09-12 11:49:37 +01:00
Alex Orlenko
09da7a41e5
Add new serde option "detect_mixed_tables"
...
This option would allow detecting mixed tables (with array-like and map-like entries or several borders)
to encoding them chosing the best method (as a map or as a table).
2025-09-12 11:11:18 +01:00
Alex Orlenko
40b507c3ec
Add ObjectLike::get_path helper
2025-09-04 19:12:44 +01:00
Alex Orlenko
5d27cb91b2
Add optional __namecall optimization for Luau
...
Add `UserDataRegistry::enable_namecall()` hint to set `__namecall` metamethod to enable Luau-specific method resolution optimization.
2025-09-02 00:53:12 +01:00
Alex Orlenko
f06d0020ea
Add test to emulate method through field
2025-08-28 23:50:18 +01:00
Alex Orlenko
d399559d30
Add Lua::yield_with to allow yielding Rust async functions and exchange values between Lua coroutine and Rust.
...
This functionality is similar to `coroutine.yield` and `coroutine.resume` without C restrictions.
2025-08-28 18:41:24 +01:00
Alex Orlenko
30735d5ff1
Fix thread recovery when pushing a bad arg
...
We should not erase thread stack if a bad argument is pushed before resuming the thread.
2025-08-25 23:07:37 +01:00
Alex Orlenko
347856b806
Do not try to yield at non-yielable points in Luau interrupt
...
In particular we cannot yeild across metamethod/C-call boundaries.
This behaviour matches with Lua 5.3+ yielding from hooks only at safe points.
Closes #632
2025-08-25 12:19:50 +01:00
Alex Orlenko
774a63bece
Add Buffer::cursor() method
...
This can be useful for providing access to buffers through core IO traits.
2025-08-24 11:29:01 +01:00
Alex Orlenko
c481c87eac
Add Lua::create_buffer_with_capacity method
...
This allow creating a preallocated buffer with specified size initialized to zero.
2025-08-23 22:38:55 +01:00
Alex Orlenko
85b280a9d6
Update nightly Rust error message matching
2025-08-23 09:40:13 +01:00
Alex Orlenko
5f38445558
Fix warnings
2025-08-20 16:25:06 +01:00
Alex Orlenko
f0806a6d62
Lower fastpath table creation limit to 1 << 26
...
When Lua is configured without memory restrictions, we use fastpath for table creation (unprotected mode).
In generally it's safe as long as we `abort()` on allocation failure.
However some Lua versions have additional restrictions on table size that we need to adhere in mlua too.
Probably Luau has the lowest limits.
Fixes #627
2025-08-13 22:49:40 +01:00
Alex Orlenko
cb153a52b2
Make Luau registered aliases case-insensitive
...
Executing `require("@my_module")` or `require("@My_Module")` should give the same result and use case-insensitive name.
See #620 for details
2025-07-26 22:23:16 +01:00
Alex Orlenko
b1c69d3005
Use to_bits comparison to check if a float value can be represented as an integer losslessly.
...
This allows to simplify the code while still maintaining "negative zeros" edge case.
Thanks @JasonHise for the suggestion.
2025-07-25 21:25:08 +01:00
Alex Orlenko
841bd332e4
Fix LuaJIT negative zero tests
2025-07-25 15:24:04 +01:00
Alex Orlenko
815d1bd7c9
Better handling negative zeros to match Lua 5.3+ behavior
...
In Lua 5.3+ the function `lua_isinteger` returns "false" for -0.0 numbers.
In earlier Lua versions we should follow the same behavior to avoid losing the sign when converting to Integer.
Close #618
2025-07-25 14:32:47 +01:00
Alex Orlenko
a653d08768
Simplify Compiler::add_library_constant (combine lib and member)
2025-07-09 00:11:46 +01:00
Alex Orlenko
2b6b0144a1
Merge Compiler::set_vector_lib into set_vector_ctor
2025-07-08 23:55:45 +01:00
Alex Orlenko
b1f73ec29d
Update Luau Compiler methods to better control extra options:
...
- Add `add_mutable_global`
- Add `add_userdata_type`
- Replace `set_library_constants` with `add_library_constant`
- Add `add_disabled_builtin`
2025-07-08 22:22:44 +01:00
Alex Orlenko
ca22ea3be7
Deprecate Debug::curr_line() in favour of Debug::current_line() that returns Option
2025-07-08 10:09:26 +01:00
Alex Orlenko
646827a6bb
Update Table::set_metatable
...
- Return Err (instead of panic) when trying to change readonly table (Luau)
- Slightly optimize performance
2025-07-06 11:37:02 +01:00
Alex Orlenko
c90cac5189
Add Lua::set_globals method to replace global environment.
...
Closes #611
2025-07-06 10:57:25 +01:00
Alex Orlenko
a3302afdc1
Deprecate Value::as_str and Value::as_string_lossy
...
These methods don't follow Rust naming convention, see
https://rust-lang.github.io/api-guidelines/naming.html#ad-hoc-conversions-follow-as_-to_-into_-conventions-c-conv
2025-07-01 22:35:40 +01:00
Alex Orlenko
dfb4e9a668
Fix LuaJIT stack inspection tests
2025-07-01 21:40:06 +01:00
Alex Orlenko
a3697ab1db
Add Debug::function method to get function running at a given level.
...
Close #607
2025-06-30 23:25:36 +01:00
Alex Orlenko
faf547c154
Refactor Lua::inspect_stack and debug interface.
...
It was possible to cause a crash when getting a `Debug` instance and keeping it while deallocating the Lua stack frames.
2025-06-30 12:21:10 +01:00