Alex Orlenko
3bfaee4ecc
Delay "any" userdata metatable creation until first instance
2024-11-16 01:47:04 +00:00
Alex Orlenko
89b68e2a24
Remove generic from RawLua::push_userdata_metatable.
...
This should help to reduce amount of generated code.
2024-11-16 01:44:17 +00:00
Alex Orlenko
a3cd25db7a
Support Luau 0.650 native vector library
2024-11-09 12:44:00 +00:00
Alex Orlenko
a7d0691e10
Add AnyUserData::destroy method
2024-11-07 16:12:20 +00:00
Alex Orlenko
05778fbe6f
Don't store and use wrong main Lua state in module mode (Lua 5.1/JIT only).
...
When mlua module is loaded from a non-main coroutine we store a reference to it to use later.
If the coroutine is destroyed by GC we can pass a wrong pointer to Lua that will trigger a segfault.
Instead, set main_state as Option and use current (active) state if needed.
Relates to #479
2024-11-04 15:48:22 +00:00
Alex Orlenko
76b896edcc
Fix attaching __gc metamethod
...
Bug introdused in ddebf56
2024-10-29 22:56:29 +00:00
Alex Orlenko
ddebf56b41
Defer metatable return on userdata creation until the end
...
Relates to #477
2024-10-29 21:22:34 +00:00
Alex Orlenko
3dc58cdfc9
Move Luau Vector type to top level
2024-10-22 22:41:26 +01:00
Alex Orlenko
93a1a55aaa
Update docs
2024-10-19 23:10:43 +01:00
Alex Orlenko
3787ff9e8c
Optimize metatable pointer lookup for userdata (Luau)
2024-10-12 21:38:07 +01:00
Alex Orlenko
640cb2c182
Add _unguarded to RawLua::app_data_ref (for internal use only)
2024-10-07 13:37:41 +01:00
Alex Orlenko
03a4068d55
Move MultiValue from value to multi module
2024-10-07 13:37:39 +01:00
Alex Orlenko
9f6c78532f
Move IntoLua/FromLua and IntoLuaMulti/FromLuaMulti to traits module
2024-10-07 10:32:50 +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
7839c4438c
Fix compilation warnings
2024-10-01 22:28:47 +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
8274b5fa88
More user-friendly error message on userdata mismatch
2024-09-23 15:56:29 +01:00
Alex Orlenko
8bb2b444ab
Run tests with forced memory limit checks
2024-09-22 23:20:18 +01:00
Alex Orlenko
fc1570d2d7
Support yielding from hooks for Lua 5.3+
2024-09-22 19:04:32 +01:00
Alex Orlenko
fce85381c6
Fix clippy warnings
2024-09-22 19:02: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
da4404baa5
Add Lua::scope back
2024-09-20 13:01:55 +01:00
Alex Orlenko
7957c6868d
Fastpath for LuaString/integer/float conversion from Lua
2024-09-07 12:25:35 +01:00
Alex Orlenko
7272e40c23
Faster non-scoped callbacks
2024-09-03 01:34:55 +01:00
Alex Orlenko
c6ef393ce9
Turn Lua::entrypoint() to constructor (don't require initializing Lua first)
2024-09-02 23:43:52 +01:00
Alex Orlenko
d25f2fc07c
Take Table instead of impl IntoLua in Chunk::set_environment()
2024-09-01 23:06:27 +01:00
Alex Orlenko
104e242ddd
Some cosmetic changes
2024-09-01 22:48:56 +01:00
Alex Orlenko
825bdbfa04
Use dynamic Lua state ownership instead of compile-time module cfg flag to allow
...
creating new VMs in module mode (and destructing them properly).
2024-08-31 22:52:55 +01:00
Alex Orlenko
4018a17e26
Combine TableExt and AnyUserDataExt traits into ObjectLike
2024-08-30 22:50:03 +01:00
Alex Orlenko
5ebbc0868c
More inline const expressions
2024-08-29 22:05:28 +01:00
Alex Orlenko
3774296835
Run gargabe collection on main Lua instance drop
...
This should help preventing leaking memory when capturing Lua in async block
and dropping future without finishing polling.
2024-08-29 11:59:52 +01:00
Alex Orlenko
21149106ee
Remove drop field from ValueRef
2024-08-26 11:18:17 +01:00
Alex Orlenko
9891e86d16
Remove Clone requirement from UserDataFields::add_field()
2024-08-26 11:10:34 +01:00
Alex Orlenko
ecc09c4387
Add luaL_loadbufferenv helper to all Lua versions
2024-08-25 17:29:58 +01:00
bjcscat
7bfd32750d
Change chunk env to use luau's load env parameter ( #442 )
2024-08-25 16:50:41 +01:00
Alex Orlenko
9931709ecd
Remove explicit lifetime from UserDataMethods and UserDataFields traits.
...
Pass `'static` arguments to async functions and require `'static` Future.
(in future we can use async closures to make it more elegant).
2024-08-23 00:10:29 +01:00
Alex Orlenko
c58f67b140
Add MaybeSend requirement to Lua futures
2024-08-10 17:55:39 +01:00
Alex Orlenko
aa47324ee9
Use pool for MultiValue container
2024-08-05 22:07:19 +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
d5173380e3
Split util module
...
Refactor internal userdata types to switch to the new `TypeKey` trait
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
c1395ab543
clippy
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