Alex Orlenko
1f970824b4
Support user thread creation callback (Luau)
2025-03-28 11:51:35 +00:00
Alex Orlenko
806817212e
Rename Lua::init_from_ptr to Lua::get_or_init_from_ptr.
...
Return reference to `&Lua` with unbound lifetime (chosen by user).
2025-03-21 21:28:30 +00:00
Alex Orlenko
0ce599aff2
Update test case
2025-03-13 17:41:13 +00:00
Alex Orlenko
1ebb4b468a
Support 52-bit integers for Luau
...
Simply to float conversion (it actually never fails or goes out of range)
2025-03-13 16:18:44 +00:00
Alex Orlenko
c1f8abba9e
Do not allow recursive warnings (Lua 5.4)
2025-02-09 15:08:52 +00:00
Alex Orlenko
2b6172ef38
Fix tests
2025-02-05 19:01:07 +00:00
Joel Natividad
20f7ce097d
Fix typos ( #522 )
...
* fix various typos in the codebase
* fix typos in CHANGELOG.md
2025-02-05 16:16:20 +00:00
Alex Orlenko
5fd96c7908
Don't run GC finalizers on ref thread.
...
If this happen then we don't have full access to the ref thread stack.
Fixes #491
2024-11-30 01:00:31 +00:00
Alex Orlenko
a8d5f23818
Add Lua::try_app_data_ref and Lua::try_app_data_mut
2024-10-30 15:22:55 +00:00
Alex Orlenko
446d63a77e
More tests
2024-10-23 15:50:58 +01:00
Alex Orlenko
c638d90b02
Fix test_inspect_stack
2024-10-19 00:11:05 +01:00
Alex Orlenko
c68e3c4f41
Some DebugStack improvements
2024-10-18 22:48:41 +01:00
Alex Orlenko
7535a23fa2
Update function tests
2024-10-16 15:59:13 +01:00
Alex Orlenko
04d8106676
Remove SubtypeId from AnyUserData and instead add Value::Other variant that will cover any unknown types (eg. LuaJIT CData)
2024-10-02 12:16:48 +01:00
Alex Orlenko
235c32006c
Rename Lua::with_raw_state to Lua::exec_raw
2024-09-24 23:11:16 +01:00
Alex Orlenko
5162a0f46e
Add Lua::with_raw_state to provide easy low-level access to the Lua state.
2024-09-22 11:25:38 +01:00
Alex Orlenko
4977b91a98
Detect compilation error and return Result when using Compiler::compile() interface.
...
Closes #387
2024-08-25 23:07:13 +01:00
Alex Orlenko
4082b354fe
clippy
2024-08-01 00:55:10 +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
d9941ef409
Take &mut RegistryKey in Lua::replace_registry_value.
2024-07-31 13:42:38 +01:00
Alex Orlenko
b4892c228c
Add rustfmt.toml
2024-07-31 13:42:37 +01:00
Alex Orlenko
658f2a13ea
Support multi threads under send feature flag
2024-07-31 13:42:37 +01:00
Alex Orlenko
cd6d86a5ce
Split single lua module to multiple submodules under state
2024-07-31 13:42:37 +01:00
Alex Orlenko
c23fa5aa6c
Optimize RegistryKey internals
...
- Store single `AtomicI32` field instead of pair i32,AtomicBool
- Make creation faster by skipping intermediate `Value` layer
Add new `RegistryKey::id()` method to return underlying identifier
2024-06-18 16:09:06 +01:00
Alex Orlenko
a79840afc9
Suppress Rust 1.77 dead_code false warnings.
2024-03-23 11:42:46 +00:00
Alex Orlenko
f4d783cb41
Impl push_into_stack for StdResult
2024-02-01 23:42:44 +00:00
Alex Orlenko
8200bee467
Implement IntoLua for ref to String/Table/Function/AnyUserData
...
This would prevent cloning plus has better performance when pushing values to Lua stack (`IntoLua::push_into_stack` method)
2024-01-23 22:14:50 +00:00
Alex Orlenko
727f99ee4d
Implement IntoLua for &RegistryKey
...
This would allow just passing registry keys to arguments with fasttrack to push directly into stack.
2024-01-20 22:04:28 +00:00
Alex Orlenko
9ed0d90746
Run tests for wasm32-unknown-emscripten
2024-01-06 12:12:56 +00:00
Alex Orlenko
34476ebf53
Support LuaJIT cdata type (produced by ffi module)
2023-11-16 13:33:23 +00:00
Alex Orlenko
e2b3464ec9
impl IntoLuaMulti for StdResult<(), E>
2023-08-20 14:17:18 +01:00
Alex Orlenko
6fb65a8fbe
Fix loading luau code starting with \t
2023-07-22 18:44:44 +01:00
Alex Orlenko
7dc6e4c132
Add Error::runtime() helper
2023-07-10 22:41:03 +01:00
Alex Orlenko
3a71bfb8a0
Refactor Lua 5.4 warnings to use &str instead of CStr
2023-07-09 14:13:05 +01:00
Alex Orlenko
b3b8d79446
Make Debug interface more user friendly
...
- use String instead of Vec<u8>
- update docs
- unify fields between lua5.x/luau
- line numbers are `usize`
2023-07-06 00:38:33 +01:00
Alex Orlenko
cea2d7fd15
Refactor application data container.
...
Now it's allowed at the same time mutably and immutably borrow different types.
Each value in the application data container is stored in it's own `RefCell` wrapper.
Also added new function `Lua::try_set_app_data()`.
2023-05-29 00:30:31 +01:00
Alex Orlenko
1c66a02878
Update to Lua 5.4.6
2023-05-21 00:55:06 +01:00
Alex Orlenko
8339621f9c
Rename to_lua_err -> into_lua_err
2023-01-06 21:35:15 +00:00
Alex Orlenko
56abc4a700
Refactor AsChunk trait
2022-12-19 21:12:36 +00:00
Alex Orlenko
de38e299fc
Use impl AsRef<str> for userdata methods/fields instead of generic param.
...
Use `impl AsRef<str>` for module names and named registry values.
2022-12-18 00:35:41 +00:00
Alex Orlenko
c88417a3b6
Redefine _VERSION for Luau to include version number.
...
https://github.com/khvzak/mlua/discussions/228
2022-12-03 21:21:28 +00:00
Alex Orlenko
f27c49f931
Fix bug when recycled Registry slot can be set to Nil.
...
This can result in allocating the same slot twice and rewriting old value.
Lua uses (registry) table length to find next free slot and having Nil in the middle of the table can impact length calculation.
With this fix we ensure that Nil values uses a special LUA_REFNIL slot.
2022-11-07 00:10:57 +00:00
Alex Orlenko
33278d4a64
Check if chunk is empty in luaL_loadbufferx for Luau ( fixes #200 )
2022-08-23 11:35:08 +01:00
Alex Orlenko
a05a58b258
Update integer/number coercion logic
2022-05-30 19:26:12 +01:00
Alex Orlenko
62db3adde1
Add "send" test
2022-05-26 22:22:23 +01:00
Alex Orlenko
1e61d1dadc
Return binary chunks support in safe mode.
...
Lua has many ways to load binary bytecode and this restriction was easy to bypass.
2022-03-21 01:08:47 +00:00
Alex Orlenko
32124b31a0
Move chunks structs to a new module.
...
Add Luau Compiler interface to compile sources.
2022-03-21 01:08:47 +00:00
Alex Orlenko
3e5f8e7bb8
Enable Lua::inspect_stack for Luau
2022-03-21 01:08:47 +00:00
Alex Orlenko
c322e028e2
Initial Luau support
2022-03-20 20:30:20 +00:00
Alex Orlenko
6190427f37
Add Lua::replace_registry_value
2022-02-14 20:51:24 +00:00