48 Commits

Author SHA1 Message Date
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 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 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 2b6b0144a1 Merge Compiler::set_vector_lib into set_vector_ctor 2025-07-08 23:55:45 +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 634e5d4550 Reduce collectgarbage options in sandboxed mode
See https://luau.org/sandbox#library
2025-06-13 15:47:54 +01:00
Alex Orlenko 76a8f8cc71 Add __type to Error's userdata metatable.
Close #585
2025-05-27 01:31:54 +01:00
Alex Orlenko f36aaa5ce1 Add loadstring function to Luau
Closes #578
2025-05-15 11:10:42 +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 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 1f970824b4 Support user thread creation callback (Luau) 2025-03-28 11:51:35 +00:00
Alex Orlenko cacd3dc70f Add Table::set_safeenv method (Luau) 2024-12-04 10:40:49 +00:00
Alex Orlenko a3cd25db7a Support Luau 0.650 native vector library 2024-11-09 12:44:00 +00:00
Alex Orlenko 7535a23fa2 Update function tests 2024-10-16 15:59:13 +01:00
Alex Orlenko 529361fcbc Add new Buffer type for Luau.
Previously it was represented as `AnyUserData` which is not always convenient.
2024-10-01 15:21:19 +01:00
Alex Orlenko ca69be07ff Support setting metatable for Lua builtin types.
Closes #445
2024-09-23 10:45:57 +01:00
Alex Orlenko ece66c46bf Remove unstable feature flag 2024-08-26 23:51:58 +01:00
Alex Orlenko c117a4c1af Fix loading (fetching) stdlib modules when using require in Luau.
Fixes #435.
2024-08-04 18:55:17 +01:00
Alex Orlenko 3641c98959 Prepare for Rust 2024 edition (see rust-lang/rust#123748)
Replace `IntoLua(Multi)` generic with positional arg (impl trait) where possible
This allow to shorten syntax from `a.get::<_, T>` to `a.get::<T>`
2024-07-31 23:42:43 +01:00
Alex Orlenko b7d170ab9b Refactor ThreadStatus:
- Add `ThreadStatus::Running`
- Replace `ThreadStatus::Unresumable` with `ThreadStatus::Finished`
Change `Error::CoroutineInactive` to `Error::CoroutineUnresumable`
2024-07-31 22:34:45 +01:00
Alex Orlenko b4892c228c Add rustfmt.toml 2024-07-31 13:42:37 +01:00
Alex Orlenko 317ce7caa6 Add Lua::set_fflag() to control Luau feature flags 2024-05-04 21:15:22 +01:00
Alex Orlenko e30b425224 Fix crash when initializing Luau sandbox without stdlibs (#361) 2024-01-27 11:51:59 +00:00
Alex Orlenko 9ed0d90746 Run tests for wasm32-unknown-emscripten 2024-01-06 12:12:56 +00:00
Alex Orlenko 66e01548ce Update Luau+windows require dylib failed test 2023-11-20 22:16:44 +00:00
Alex Orlenko 93b505cff9 Integrate Luau package into mlua api.
Eg. `Lua::load_from_std_lib` with `StdLib::PACKAGE` is now supported for Luau.
2023-11-20 12:08:08 +00:00
Alex Orlenko 2d775695ef Rewrite Luau require function to support module loaders.
Also add `package` library with `path`/`loaded`/`loaders`.
2023-11-16 14:39:17 +00:00
Alex Orlenko 5043447f23 Support Luau buffer type and and library.
Buffer is an object that represents a fixed-size mutable block of memory and added to Luau 0.601.
See https://luau-lang.org/library#buffer-library for more details.
2023-11-16 12:55:58 +00:00
Alex Orlenko 0e4476c2e3 Add Lua::set_vector_metatable() method (unstable) 2023-08-12 22:46:21 +01:00
Alex Orlenko dc94d51d97 Update Luau compiler options 2023-07-28 21:45:19 +01:00
Alex Orlenko 7dc6e4c132 Add Error::runtime() helper 2023-07-10 22:41:03 +01:00
Alex Orlenko 1f0e81c9a1 Add a dedicated type for Luau vector.
Refactor existing implementation and add 4-dimensional vectors support.
2023-06-20 13:30:42 +01:00
Alex Orlenko 16bec29274 Fix setting Luau version number in _VERSION env var 2023-06-07 12:35:45 +01:00
Alex Orlenko 742307a267 Add &Lua to luau interrupt callback (fixes #197) 2023-03-25 16:30:31 +00:00
Alex Orlenko a6ca65aa74 Better checks and tests when trying to modify a Luau readonly table 2022-10-30 11:41:09 +00:00
Alex Orlenko 1040c0a347 Fix typo 2022-10-22 23:44:21 +01:00
Alex Orlenko 44a8d86d8a Fix error message in tests (luau) 2022-08-23 23:08:00 +01:00
Alex Orlenko 70e16b51ae Set source name to full file path in Luau require 2022-06-29 11:25:16 +01:00
Alex Orlenko 0076aa735a Add Function::coverage for Luau to obtain coverage report 2022-05-24 02:01:46 +01:00
Alex Orlenko 21affdadfd Remove Luau compiler options from Chunk in favour of setting Compiler instance.
Add ability to set global Luau compiler used for load all chunks including via require function.
2022-04-14 00:54:29 +01:00
Alex Orlenko 70d287cf9f Don't pass Lua handler to interrupt callback (Luau) as it's not safe.
Optimize callback_error_ext to check stack only before allocating a new WrappedFailure.
2022-04-08 10:45:28 +01:00
Alex Orlenko 595dc3e95f Move some Luau functionality to a new module
Immplement native "vector" function to construct vectors
2022-03-31 19:31:37 +01:00
Alex Orlenko 595bc3a2b3 Support Luau interrupts (closes #138) 2022-03-30 22:01:06 +01:00
Alex Orlenko 87c10ca93d Sandboxing support 2022-03-28 23:42:35 +01:00
Alex Orlenko 0a3b65af88 Support readonly table attribute (luau) 2022-03-22 21:33:29 +00:00
Alex Orlenko 3a9c8c2da2 Add Luau vector datatype support 2022-03-22 21:14:06 +00:00
Alex Orlenko 4e0ba6559e Add require function to Luau 2022-03-21 01:08:48 +00:00