Alex Orlenko
b674d7906d
Include (known) userdata type to Value debug pretty-print
2023-05-28 01:12:42 +01:00
Alex Orlenko
3d7796de55
clippy
2023-05-27 22:08:42 +01:00
Alex Orlenko
bbd2488f79
Add OwnedAnyUserData::take()
2023-05-03 23:29:33 +01:00
Alex Orlenko
4daa7de997
Various improvements for owned types, including:
...
- tests
- shortcuts for `OwnedFunction` and `OwnedAnyUserData`
2023-04-26 15:40:48 +01:00
Alex Orlenko
be64706cff
Missing doc for OwnedAnyUserData
2023-04-14 10:29:34 +01:00
Alex Orlenko
0fccdfed5c
Fix feature flags for owned types
2023-04-14 01:17:26 +01:00
Alex Orlenko
aaf0a5e44a
Remove usage of crate::ffi (clippy)
2023-04-14 00:36:31 +01:00
Alex Orlenko
f66932e8d2
Revert "Rename Owned*::to_ref() to as_ref()"
...
This reverts commit 5394faca16 .
2023-03-30 22:35:43 +01:00
Alex Orlenko
5394faca16
Rename Owned*::to_ref() to as_ref()
2023-03-02 15:36:11 +00:00
Alex Orlenko
68b60e2a0a
Add UserDataRef and UserDataRefMut types that implement FromLua
...
and can be used as accessors to underlying `AnyUserData` type.
2023-02-26 21:52:28 +00:00
Alex Orlenko
f52abf919e
Add create_userdata_ref/create_userdata_ref_mut for scope ( #206 )
...
New methods would allow creating userdata objects from (mutable) reference
to a UserData of registered type.
2023-02-12 16:37:02 +00:00
Alex Orlenko
47c8300ccf
Allow registering and creating custom userdata types that don't necessary implement the UserData trait.
...
This is useful to register 3rd party types that cannot implement `UserData` due to Rust orphan rules.
See #206
2023-02-03 23:46:04 +00:00
Alex Orlenko
88da28a68d
Allow deserializing values from serializable UserData using Lua::from_value() method.
...
Closes #240
2023-01-06 10:41:17 +00:00
Alex Orlenko
d67332a3ac
Refactor userdata::MetaMethod.
...
Take `impl AsRef<str>` as name of metamethod (instead of `Into<MetaMethod>`) in UserDataMethods/UserDataFields.
Change position of generic args in userdata.
2022-12-24 19:16:58 +00:00
Alex Orlenko
a13c188de3
Rename ToLua/ToLuaMulti -> IntoLua/IntoLuaMulti
2022-12-19 23:00:47 +00:00
Alex Orlenko
c60f633a62
Add "unstable" feature flag.
...
Hide owned types under the new feature flag.
Drop OwnedString/OwnedThread types (unlikely they are useful).
2022-12-19 22:26:44 +00:00
Alex Orlenko
9b4e3a1598
Refactor LuaInner state
...
Add static_assertions to check for auto traits impl on compilation stage
Bump MSRV to 1.63 (required for `Ref::filter_map`)
2022-12-19 16:09:05 +00:00
Alex Orlenko
c44463f030
Replace impl AsRef<str> with simple &str
2022-12-18 00:35:41 +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
7526773a90
Do not clear usevalues when taking value out of userdata.
...
It has big performance penalty.
Lua GC can collect uservalues when userdata is not referenced anymore.
2022-12-18 00:35:41 +00:00
Alex Orlenko
bf79d9e75d
Initial implementation of owned Lua types
2022-12-18 00:35:41 +00:00
Alex Orlenko
3aac7131ee
Add Iter metamethod for Luau (available from 0.526)
2022-05-09 14:34:10 +01:00
Alex Orlenko
a8fef51e86
(minor) Fix capturing variables in protect_lua closures
2022-04-08 21:15:57 +01:00
Alex Orlenko
ec1fa04085
Update docs
2022-03-25 00:43:54 +00:00
Alex Orlenko
c322e028e2
Initial Luau support
2022-03-20 20:30:20 +00:00
Alex Orlenko
2fee3e7891
Update docs
2021-11-25 18:01:41 +00:00
Alex Orlenko
e2ebe65306
Add get_named_user_value and set_named_user_value to AnyUserData
2021-11-21 23:42:47 +00:00
Alex Orlenko
153502ec73
Add set_nth_user_value and get_nth_user_value to AnyUserData
...
with `n` up to 65535 for all Lua versions.
2021-11-08 21:16:31 +00:00
Alex Orlenko
ad70ba54a5
Publish AnyUserData::take
2021-11-04 12:32:19 +00:00
Alex Orlenko
806f0bcef4
Add luajit52 support (LuaJIT with partial compatibility with Lua 5.2)
2021-11-04 12:26:11 +00:00
Alex Orlenko
d7d987fa14
Add async meta methods for all Lua except 51
2021-11-04 00:57:49 +00:00
Alex Orlenko
ed48b11e7f
Update documentation references
...
Using rustdoc links (see RFC https://github.com/rust-lang/rfcs/pull/1946 )
2021-10-12 00:49:45 +01:00
Alex Orlenko
a544e41b33
Add (hidden) method UserData::take() to take out value from userdata
2021-10-05 15:46:50 +01:00
Alex Orlenko
d586eef0f5
Refactor UserData metatables handling
2021-09-28 16:33:36 +01:00
Alex Orlenko
ee1c8a1a3d
Add inline attributes to few hot funcs
2021-09-28 16:19:29 +01:00
Alex Orlenko
1020315a9b
Update documentation about FromLua for UserData. Closes #64
2021-08-04 12:12:02 +01:00
Alex Orlenko
5fb7b96704
Replace custom UserDataRef(Mut) with standard Ref(Mut)
2021-07-13 10:53:10 +01:00
Alex Orlenko
17162b1e0b
UserData improvements:
...
1) Optimize `make_userdata` call
2) Refactor `UserDataWrapped` and make it enum
2021-07-11 01:30:17 +01:00
Alex Orlenko
d3f44354e0
Revert commit ced808d5ab
...
I think this experiment is unsuccessful and does not work well in a module mode
with dynamic symbols resolution and mixing between different mlua instances.
Overall the Rust bug has been fixed and we can wait for the "C-unwind" feature become stable.
2021-06-16 22:13:01 +01:00
Alex Orlenko
abb95c3c56
Remove T: Clone requirement from add_async_function
2021-06-03 23:21:00 +01:00
Alex Orlenko
64faebf407
Add __ipairs metamethod (again) for Lua 5.2 only
2021-06-03 18:43:29 +01:00
Alex Orlenko
a944f4ad6f
Implement UserData for Rc<RefCell>/Arc<Mutex>/Arc<RwLock> wrappers
2021-06-03 16:42:55 +01:00
Alex Orlenko
0bad4a0ff9
Fix spelling
2021-05-10 19:53:38 +01:00
Alex Orlenko
5293b8d6d2
Add Thread::reset() for luajit/lua54
2021-05-05 11:11:32 +01:00
Alex Orlenko
7541b6f3f3
Remove deprecated AnyUserData::has_metamethod()
2021-05-04 23:57:47 +01:00
Alex Orlenko
3f55958bdd
Stack assertions review
...
Other minor code and documentation updates
2021-05-02 11:42:03 +01:00
Alex Orlenko
463fc646bc
Refactor UserDataCell
2021-04-27 21:55:31 +01:00
Alex Orlenko
c7541ef7d3
More tests
2021-04-27 00:29:38 +01:00
Alex Orlenko
41a1a0d15a
Add more checks for destructed userdata in AnyUserData
2021-04-27 00:29:38 +01:00
Alex Orlenko
c10169a380
cargo fmt and other minor fixes
2021-04-27 00:29:38 +01:00