Michael Pfaff
11d81209d9
API changes, inline more often
2023-07-06 13:06:08 -04:00
Alex Orlenko
925a2816cc
clippy
2023-07-06 00:59:46 +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
399e469328
Update "async userdata method" benchmark
2023-06-21 22:23:43 +01:00
Alex Orlenko
1367a033d7
Don't clone function when doing call_async()
2023-06-21 13:14:17 +01:00
Alex Orlenko
c1168d3ec1
Refactor `call_async()` functions to use static dispatch outside of traits
2023-06-21 12:44:24 +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
aeacf6cacc
Remove `allow(dead_code)` from mlua-sys build scripts
2023-06-20 23:49:48 +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
cf0524aa23
Use lua_iscfunction instead of lua_getinfo in `Function::environment()`
2023-06-08 09:33:48 +01:00
Alex Orlenko
03b6dfb2c3
v0.9.0-beta.3
2023-06-07 14:40:49 +01:00
Alex Orlenko
cf1cb31150
mlua_derive: v0.9.0-beta.2
2023-06-07 13:08:02 +01:00
Alex Orlenko
7d586f52f2
mlua-sys: v0.2.0
2023-06-07 13:06:51 +01:00
Alex Orlenko
e85818e199
mlua-sys: include luau to luau-codegen feature flag
2023-06-07 13:05:16 +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
e7b712e29f
Rely on LUA_MINSTACK in callbacks
2023-06-06 21:38:45 +01:00
Alex Orlenko
d5483988d2
Optimize polling async functions (40% performance win)
2023-06-04 20:53:12 +01:00
Alex Orlenko
0f5c68dcf8
Update criterion to 0.5
2023-06-04 18:31:10 +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
9596f2e9ee
Fix warning when compiling for lua51
2023-06-03 14:24:34 +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
9785722d61
Require environment to be a Table instead of Value in Chunks.
...
In addition to that, `AsChunk::env()` renamed to `AsChunk::environment()`.
2023-06-03 00:00:53 +01:00
Alex Orlenko
c905a34b1d
(Luau) Set thread globals to main thread globals when resetting the thread
2023-06-02 21:13:23 +01:00
Alex Orlenko
a1089dbf95
Optimize a bit calling Rust functions from Lua.
...
This is done by reusing upvalue as a captured variable.
Also in async functions upvalue is always set (async cannot be scoped) so extra checks removed.
2023-05-30 15:15:20 +01:00
Alex Orlenko
baf25e263f
Change _mlua to __mlua prefix for internal chunk names
2023-05-30 00:36:09 +01:00
Alex Orlenko
3abf73dee5
Update `FunctionInfo` doc and interface
2023-05-30 00:33:57 +01:00
Alex Orlenko
4adebd31f9
Update .gitignore
2023-05-30 00:33:16 +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
e0224ab159
Use futures-core and futures-tasks via futures-util.
...
Just to reduce number of dependencies.
2023-05-29 00:30:29 +01:00
Alex Orlenko
6dee339783
Use `lua_closethread` in `AsyncThread::drop()`
2023-05-28 01:43:15 +01:00
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
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
2efc637ab9
Move util into mod and add `short_type_name` function
2023-05-25 10:23:52 +01:00
Alex Orlenko
22e748557c
Add new feature flag `luau-jit` to enable experimental Luau codegen backend
2023-05-24 23:13:12 +01:00
Alex Orlenko
77effb5055
Refactor `callback_error_ext`
...
Also it makes rust-analyzer happy
2023-05-24 00:46:59 +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
bbd2fe06e1
Use `DeserializeOwned` and remove lifetime from `LuaSerdeExt` trait
2023-05-06 23:07:34 +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
3253ae8f4a
v0.9.0-beta.2
2023-04-27 23:13:32 +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
21b834decc
Update coverage calculation (exclude mlua-sys)
2023-04-26 22:22:11 +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
bd68a155c0
Replace ManuallyDrop with MaybeUninit
2023-04-26 15:40:47 +01:00
Alex Orlenko
993aaf44c7
mlua-sys: v0.1.1
2023-04-24 11:25:22 +01:00
Alex Orlenko
54cbc62727
mlua-sys: use luau-src v0.5.6+luau573
2023-04-24 11:24:32 +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
d0cbd32ad2
(clippy) mlua_derive: don't clone function name
2023-04-22 11:07:33 +01:00
Alex Orlenko
be64706cff
Missing doc for OwnedAnyUserData
2023-04-14 10:29:34 +01:00
Alex Orlenko
c178bc0a55
cargo fmt
2023-04-14 10:29:12 +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
98888883bc
mlua-sys: clippy
2023-04-14 00:31:06 +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
f9d1213c4b
Don't set html_root_url (it's not recommended)
2023-04-13 22:44:40 +01:00
Alex Orlenko
dc10c80e61
Add documentation url to mlua-sys
2023-04-13 22:32:27 +01:00
Alex Orlenko
23b9cefdca
Add missing `doc_cfg` feature to mlua-sys
2023-04-13 21:55:37 +01:00
Alex Orlenko
15dc0e9f23
Move ffi module into mlua-sys crate
2023-04-12 23:23:34 +01:00
Alex Orlenko
0c53e09e30
Update tarpaulin settings
2023-04-12 01:03:33 +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
483bc80fc4
Add `must_use` to `AsyncThread`
2023-04-05 00:23:13 +01:00
Alex Orlenko
354c69acc4
Update README
2023-03-30 23:22:01 +01:00
Alex Orlenko
6fa0a78ec0
Prepare v0.9.0-beta.1
2023-03-30 23:18:10 +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
da6d5a93c9
Update rustyline dependency
2023-03-30 22:34:41 +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
0848ddcdf7
Clippy
2023-03-28 20:53:22 +01:00
Alex Orlenko
e182d474e0
More user-friendly error message about missing value for `name` attribute in module macro
...
Update the `[lua_module]` doc
2023-03-28 16:27:16 +01:00
Alex Orlenko
0f937b0a03
Switch to syn 2.0
2023-03-28 13:56:59 +01:00
Alex Orlenko
cd9fc1d08f
Update Error doc
2023-03-26 20:58:43 +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
9c1669020b
Clippy
2023-03-25 23:38:57 +00:00
Alex Orlenko
742307a267
Add &Lua to luau interrupt callback ( fixes #197 )
2023-03-25 16:30:31 +00:00
Alex Orlenko
781ded573a
Seal LuaSerdeExt/TableExt/AnyUserDataExt
2023-03-19 02:38:21 +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
8d80321738
Add `ErrorContext` extension trait to attach additional context to `Error`
2023-03-17 01:20:57 +00:00
Alex Orlenko
a0d37fd182
Rename `error` to `cause` in `Error::BadArgument`
2023-03-16 23:48:54 +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
3059f82552
Update README and CHANGELOG
2023-03-12 23:54:19 +00:00
Alex Orlenko
22fbcfd9fb
Update edition everywhere
2023-03-12 01:03:31 +00:00
Alex Orlenko
304880bfd1
Fast metatable check for Lua::push_userdata_ref
2023-03-10 10:34:41 +00:00
Alex Orlenko
33c276d0b4
Optimize userdata methods call when __index and fields_getters are nil
2023-03-04 11:58:34 +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
d7db1b7f2e
Add Waker lifetime to WakerGuard
2023-03-03 18:29:04 +00:00
Alex Orlenko
22c973af02
Async: Don't clone function when executing it from recycled thread
2023-03-03 18:22:39 +00:00
Alex Orlenko
8c18fa1764
Async: store pointer to Waker in extra data rather than in Lua ref thread
2023-03-03 15:19:54 +00:00
Alex Orlenko
5394faca16
Rename `Owned*::to_ref()` to `as_ref()`
2023-03-02 15:36:11 +00:00