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
bf79d9e75d
Initial implementation of owned Lua types
2022-12-18 00:35:41 +00:00
Alex Orlenko
f27c49f931
Fix bug when recycled Registry slot can be set to Nil.
...
This can result in allocating the same slot twice and rewriting old value.
Lua uses (registry) table length to find next free slot and having Nil in the middle of the table can impact length calculation.
With this fix we ensure that Nil values uses a special LUA_REFNIL slot.
2022-11-07 00:10:57 +00:00
Alex Orlenko
e1bbd00a33
Fix getting caller information from Lua::load
2022-10-28 10:43:05 +01:00
Alex Orlenko
65396a910f
Optimize Lua::create_table to use reference thread if possible
2022-10-23 00:24:04 +01:00
Alex Orlenko
de69d10d73
Optimize Lua::create_string to use reference thread if possible
2022-10-23 00:14:13 +01:00
Alex Orlenko
fcd162f3eb
Replace Lua::ref_thread_exec
2022-10-22 23:39:49 +01:00
Alex Orlenko
0354703dbf
Update formatting (Lua registry values)
2022-10-22 23:34:19 +01:00
Alex Orlenko
9831d0e397
Check that allocation does not exceed isize::MAX
...
See https://github.com/rust-lang/rust/issues/101899
2022-10-22 23:13:02 +01:00
Alex Orlenko
29c6c9cb58
Fix clippy warnings
2022-10-09 14:08:33 +01:00
Alex Orlenko
e01af22bac
Update push_userdata_ref
2022-10-09 13:56:30 +01:00
Alex Orlenko
bf6708ba58
Fallback to Lua internal allocator if unable to create Lua VM with Rust one.
...
This should fix #194
2022-08-02 10:35:39 +01:00
Alex Orlenko
5330b900fd
Check that Lua state is non-null in init_from_ptr()
2022-08-01 15:21:14 +01:00
Alex Orlenko
ee32dc33f3
Check that lua_newstate() returns non-null Lua state
2022-08-01 12:56:36 +01:00
Alex Orlenko
ab029b087d
Close to-be-closed variables for Lua 5.4 when using call_async functions
...
Fixes #192
2022-07-31 15:33:02 +01:00
Alex Orlenko
d3b48cf2f3
Use Luau tags to mark userdata objects as destructed
2022-07-18 10:38:22 +01:00
Alex Orlenko
f75af6d75f
Fix clippy warnings
2022-07-17 11:11:30 +01:00
Alex Orlenko
059e41bafb
Optimize WrappedFailure userdata detection.
...
This is done by comparing a metatable pointer to previously saved one (it never changes).
2022-07-17 11:00:46 +01:00
Alex Orlenko
f7ee6dc635
Add lua_xpush to 5.1-5.4
2022-07-17 11:00:46 +01:00
Alex Orlenko
9596b97faa
Update Lua::create_userdata doc about sharing metatable.
...
Closes #175
2022-06-29 00:25:26 +01: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
9af1aaf889
Make clippy happy
2022-06-28 21:28:48 +01:00
Alex Orlenko
113f91ace3
Derive Default for Lua::MemoryInfo
2022-06-27 13:57:15 +01:00
Alex Orlenko
ff0d923aae
Don't use custom allocator for non-vendored LuaJIT ( fixes #176 )
2022-06-27 13:04:32 +01:00
Alex Orlenko
4516ca0bb5
Forgotten part of userdata performance optimization for Lua 5.1
2022-06-07 17:59:22 +01:00
Alex Orlenko
93d36b9068
More performance optimization (userdata part)
2022-06-06 21:42:55 +01:00
Alex Orlenko
b065db37c2
Always use Rust allocator for Lua 5.1/u
2022-05-31 02:09:58 +01:00
Alex Orlenko
a05a58b258
Update integer/number coercion logic
2022-05-30 19:26:12 +01:00
Alex Orlenko
3766cee4dd
Experimental optimization to skip oom check
2022-05-30 18:42:34 +01:00
Alex Orlenko
afa343ff08
Add [track_caller] attribute when working with app data container
2022-05-26 20:16:09 +01:00
Alex Orlenko
8d71ea79aa
Cache bytecode for internal Lua chunks
2022-05-16 20:29:02 +01:00
Alex Orlenko
6b2ceb60c4
Fix Send impl
2022-05-12 19:24:12 +01:00
Alex Orlenko
bea9b0f8b5
Assert stack for Luau in callback_error_ext when operating on a cached wrapped failure.
...
Should solve #153 .
2022-04-27 00:20:25 +01:00
Alex Orlenko
86f506a170
Fix clippy warnings
2022-04-14 21:55:36 +01:00
Alex Orlenko
d3975bdf30
Refactor AsChunk trait.
...
Remove blanket implementation for T: AsRef<[u8]>
Implement for `std::path::Path`
2022-04-14 20:48:00 +01:00
Alex Orlenko
21affdadfd
Remove Luau compiler options from Chunk in favour of setting Compiler instance.
...
Add ability to set global Luau compiler used for load all chunks including via require function.
2022-04-14 00:54:29 +01:00
Alex Orlenko
88e3e92009
Define CallbackUpvalue/AsyncCallbackUpvalue as type alises to Upvalue
2022-04-13 18:29:51 +01:00
Alex Orlenko
a018d3b6dc
Revert "Remove Lua::into_static/from_static"
...
This reverts commit f75b7b7879 .
2022-04-13 13:44:59 +01:00
Alex Orlenko
0215c31a3a
Refactor Lua instance structure.
...
The idea is to keep same Lua instance across all calls and only change context inside callbacks.
This should solve #104 .
2022-04-13 13:44:12 +01:00
Alex Orlenko
5cd82d0f6b
Refactor main_state handling
2022-04-13 13:44:11 +01:00
Alex Orlenko
55fac90a74
Fix Luau documentation in docs.rs
...
Enable `Lua::gc_inc` for Luau
Mark `debug` module as safe for Luau
2022-04-08 20:02:12 +01:00
Alex Orlenko
70d287cf9f
Don't pass Lua handler to interrupt callback (Luau) as it's not safe.
...
Optimize callback_error_ext to check stack only before allocating a new WrappedFailure.
2022-04-08 10:45:28 +01:00
Alex Orlenko
595dc3e95f
Move some Luau functionality to a new module
...
Immplement native "vector" function to construct vectors
2022-03-31 19:31:37 +01:00
Alex Orlenko
d5315da8d1
Fix tests
2022-03-31 12:23:21 +01:00
Alex Orlenko
516f01ed44
Increase internal caches size
2022-03-31 00:07:05 +01:00
Alex Orlenko
4492a20bbc
Make LuaHook as Fn instead of FnMut to remove Mutex and improve performance
2022-03-30 23:55:34 +01:00
Alex Orlenko
595bc3a2b3
Support Luau interrupts ( closes #138 )
2022-03-30 22:01:06 +01:00
Alex Orlenko
87c10ca93d
Sandboxing support
2022-03-28 23:42:35 +01:00