Commit Graph

1240 Commits

Author SHA1 Message Date
Alex Orlenko c1ffd4e790 Replace get_or_insert_with with get_or_insert_default 2026-01-29 10:46:58 +00:00
Alex Orlenko d9c139b55f Rust 2024 2026-01-29 10:33:28 +00:00
Alex Orlenko 0c4206c97d Bump min Rust version to 1.88 2026-01-29 10:13:04 +00:00
Alex Orlenko 6bb7f09927 Don't use luaL_typename to get a static type name in Luau.
In Luau this function returns heap-allocated string rather than static string,
so accessing this value when Lua state is destroyed is UB.
Fixes #674
2026-01-27 14:10:43 +00:00
Alex Orlenko e67ae7f0de Make RawLua::{push,push_value,pop_value} public 2026-01-27 12:17:58 +00:00
Alex Orlenko 8c1535c27b cargo fmt 2026-01-27 12:14:50 +00:00
WASDetchan fd245daa6f Expose RawLua via Lua::exec_raw_lua (#670) 2026-01-23 16:19:10 +00:00
Alex Orlenko 7fb7e8685f Update spelling check 2026-01-23 15:37:18 +00:00
Alex Orlenko 171cdf1758 Some fixes and more tests for Function::info 2026-01-23 12:44:22 +00:00
psentee 3f8f016daa Add num_params, is_vararg, nups to FunctionInfo (#665) 2026-01-23 11:59:59 +00:00
Alex Orlenko 8e6d652a21 Bump luau-src to 0.18.0 (Luau 0.705) 2026-01-20 13:05:00 +00:00
Alex Orlenko 1be9e6ce2d Add Lua 5.5 external strings support 2026-01-18 00:03:43 +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 a7f105c698 Update Lua::set_memory_category doc 2025-11-22 14:27:02 +00:00
Alex Orlenko 1b500b7d47 Remove generic from internal definition of RawLua::create_string 2025-11-22 13:36:50 +00:00
Alex Orlenko ce4fc80e18 Bump luau-src to 0.17.0 (Luau 0.701) 2025-11-22 12:58:59 +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 676f3a6983 Fix tests 2025-11-17 13:44:29 +00:00
Alex Orlenko 9a7f75ad6b Update require implementation to satisfy Luau 0.700 2025-11-16 23:13:11 +00:00
Alex Orlenko 1bd1359f43 Exclude the first arg when checking for yield_with call.
This is part of the previous commit
2025-11-06 23:28:37 +00:00
Alex Orlenko feec72bcbd Reduce number of allocations when calling async function
Instead of creating a uniq poller with upvalue on each async call, return future directly
and pass it to the poller
This also gives about 3-5% perf improvements
2025-11-06 23:09:26 +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 72ac247dca Fix MaybeSend doc 2025-11-04 23:20:53 +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 3a2fd1ec59 Make AnyUserData::type_name public 2025-10-17 20:00:53 +01:00
Alex Orlenko a4c8b20697 impl IntoLuaMulti for &MultiValue 2025-10-13 12:36:42 +01:00
Alex Orlenko e08768cc5e Derive Default for Value (clippy) 2025-09-28 23:42:12 +01:00
Alex Orlenko 5b38af9746 AsyncCallFuture is Unpin 2025-09-19 10:00:28 +01:00
Alex Orlenko 54907f80c5 Add SerializableValue to lib and prelude exports 2025-09-12 12:40:43 +01:00
Alex Orlenko ae512f2b49 Remove const from SerializableValue (it's not really useful) 2025-09-12 12:40:00 +01:00
Alex Orlenko 53c159b6cb Unhide Value::to_serializable 2025-09-12 11:49:43 +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 bad20374ad Simplify Table::clear method
There is no need to traverse array part, lua_next will cover everything
2025-09-08 23:37:28 +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 c70a636ca9 Remove newlines from yield_with examples 2025-08-30 12:51:53 +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 db7b782d3c Remove lifetimes from short type names 2025-08-23 09:13:31 +01:00
Alex Orlenko 5f38445558 Fix warnings 2025-08-20 16:25:06 +01:00
Alex Orlenko df0a44d405 Make Lua reference values cheap to clone
Instead of locking the VM and making a copy on auxiliary thread, track number of references using Rust ref counter.
This should also help reducing number of used references (they are limited to to 1M usually) on auxiliary thread.
2025-08-20 12:05:37 +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 36560435f7 Add push_into_stack_multi fastpath to Variadic 2025-08-10 00:35:51 +01:00
Alex Orlenko bd63f63bc9 Use ascii lowercase for module aliases
This matches with Luau 0.686 changes
2025-08-09 19:14:31 +01:00
piz-ewing c035c23a15 fix: normalize_chunk_name handles Windows paths with drive letter (#623)
Co-authored-by: ewing <ewing@MacBook-Pro.local>
2025-08-04 22:34:36 +01:00