Alex Orlenko
9fdba541e9
Update `UserDataMethods::add_async_method()` functions to take `&T` as second argument instead of cloning `T`.
...
New functions: `UserDataMethods::add_async_method_mut()`, `UserDataMethods::add_async_meta_method_mut()`.
2023-06-15 00:34:41 +01:00
Alex Orlenko
5a135a331a
Add `UserDataFields::add_field()` method to add static fields to UserData.
...
Plus `UserDataFields::add_meta_field()` for static meta fields.
Fix propagating fields to wrapped UserData types.
2023-06-07 12:18:24 +01:00
Alex Orlenko
2efc637ab9
Move util into mod and add `short_type_name` function
2023-05-25 10:23:52 +01:00
Alex Orlenko
aaf0a5e44a
Remove usage of crate::ffi (clippy)
2023-04-14 00:36:31 +01:00
Alex Orlenko
9c1669020b
Clippy
2023-03-25 23:38:57 +00:00
Alex Orlenko
03787668fd
Improve error reporting when calling Rust functions from Lua.
...
In particular new error type `Error::BadArgument` added to help identify bad argument position or name (eg `self` for userdata).
2023-03-14 23:23:46 +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
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
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
e7f494530f
Add Lua::create_proxy for easy access to UserData static fields and functions
...
Closes #178
2022-06-28 23:03:29 +01:00
Alex Orlenko
a62636fde0
More parking_lot ci tests
2022-04-17 17:29:51 +01:00
Sondre Aasemoen
a5ce0c1409
Add parking_lot dependency and feature
2022-04-16 19:45:21 +02:00
Alex Orlenko
405cff5d49
Move StaticUserData* implementation from `lua` module to the new `userdata_impl`
2022-03-21 01:08:48 +00:00