Alex Orlenko
3a71bfb8a0
Refactor Lua 5.4 warnings to use &str instead of CStr
2023-07-09 14:13:05 +01:00
Alex Orlenko
24e14c4874
Always set hook on a current Lua context (state) and remove MainThreadNotAvailable as no longer needed
2023-07-09 12:33:21 +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
85f17a269d
Add Table:is_empty() function
2023-06-26 10:50:18 +01:00
Alex Orlenko
b169031d4e
Don't use any metamethods in Table::sequence_values() iterator.
...
This is matches with `Table::pair()` iterator.
Remove `Table::raw_sequence_values()` iterator.
2023-06-26 10:46:59 +01:00
Alex Orlenko
b05698d55b
impl UserData for Rc<T> and Arc<T> where T: UserData
2023-06-21 01:30:09 +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
c2bfc9ec52
Implement PartialEq<[T]> for tables
2023-06-19 23:28:08 +01:00
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
16bec29274
Fix setting Luau version number in _VERSION env var
2023-06-07 12:35:45 +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
8ab0ccf11c
Don't keep poll function in environment globals when polling async functions.
...
This is redundant after deprecating scoped async.
Closes #281
2023-06-04 02:31:29 +01:00
Alex Orlenko
1dc32452e6
Support getting and setting environment for Lua functions.
...
Closes #218
2023-06-03 12:56:49 +01:00
Alex Orlenko
3abf73dee5
Update FunctionInfo doc and interface
2023-05-30 00:33:57 +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
b674d7906d
Include (known) userdata type to Value debug pretty-print
2023-05-28 01:12:42 +01:00
Alex Orlenko
4306e6e978
Add Value::to_string() method similar to luaL_tolstring.
...
It uses `__tostring` metamethod if set.
Closes #279
2023-05-27 01:29:08 +01:00
Alex Orlenko
68e65a8ffe
Set __name field in userdata metatable if not provided
2023-05-25 10:59:46 +01:00
Alex Orlenko
1c66a02878
Update to Lua 5.4.6
2023-05-21 00:55:06 +01:00
Alex Orlenko
1ac98e7d16
- Allow downcasting error wrapped into Error::WithContext
...
- Overwrite error context when called multiple times
2023-05-08 23:39:53 +01:00
Alex Orlenko
d951cb503f
Add Value::NULL constant
2023-05-06 22:53:40 +01:00
Alex Orlenko
bbd2488f79
Add OwnedAnyUserData::take()
2023-05-03 23:29:33 +01:00
Alex Orlenko
fdda0d3724
Update compile tests
2023-04-27 23:06:38 +01:00
Alex Orlenko
a1d385c7b7
Add OwnedString
2023-04-26 23:17:27 +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
2d6a0fdf9c
Check for reference leak detection only in mlua integratin tests.
...
This is not necessary an error and should not be enforced by default.
Fixes #268 .
2023-04-23 10:56:26 +01:00
Alex Orlenko
65e72f39ae
Remove unstable feature flag from Function::wrap/wrap_mut/wrap_async
2023-04-14 00:21:18 +01:00
Alex Orlenko
cdbf04f50c
Add pretty-print to the Debug formatting to Value to Table.
...
This would allow dumping any Lua variable in human readable form.
2023-04-11 20:36:41 +01:00
Alex Orlenko
ba324b4f54
Allow deserializing Lua null into unit(()) or unit struct. See #264
2023-04-10 01:49:51 +01:00
Alex Orlenko
3e83753466
Add Thread::set_hook() function
2023-04-08 23:53:48 +01:00
Alex Orlenko
288934c82c
Refactor HookTriggers (make it const)
2023-04-05 01:02:27 +01:00
Alex Orlenko
1be927bc5d
Don't call error handler for memory errors in coroutines
2023-03-30 17:29:57 +01:00
Alex Orlenko
d9aac08b81
Support setting memory limit for Lua 5.1/JIT/Luau
...
Other versions already support this feature.
Closes #119
2023-03-26 00:06:52 +00:00
Alex Orlenko
742307a267
Add &Lua to luau interrupt callback ( fixes #197 )
2023-03-25 16:30:31 +00:00
Alex Orlenko
6a647f58be
Add Error::downcast_ref() method
2023-03-19 00:22:51 +00:00
Alex Orlenko
4bc6501d2e
Tests for the ErrorContext trait
2023-03-17 01:31:07 +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
22fbcfd9fb
Update edition everywhere
2023-03-12 01:03:31 +00:00
Alex Orlenko
87d027e8ac
Rename rust_module in tests to test_module
...
This causes warning during compilation
2023-03-03 18:58:13 +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
94f01e597c
Add AnyUserDataExt trait with auxiliary functions for AnyUserData
2023-02-18 23:40:28 +00:00
Alex Orlenko
b66bff9155
Drop Lua::async_scope as it's unsound
2023-02-12 22:25:10 +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
8339621f9c
Rename to_lua_err -> into_lua_err
2023-01-06 21:35:15 +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
cb3d58b1c7
Better Debug for String
2023-01-04 15:56:57 +00:00
Alex Orlenko
fa46720f5a
Add Table::clear() method
2023-01-02 15:50:21 +00:00
Alex Orlenko
72b9209ae9
Rename wrapped_failure/thread cache to pool
2022-12-30 21:48:12 +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