Commit Graph

352 Commits

Author SHA1 Message Date
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
Alex Orlenko f75b7b7879 Remove Lua::into_static/from_static 2022-03-26 00:30:57 +00:00
Alex Orlenko ec1fa04085 Update docs 2022-03-25 00:43:54 +00:00
Alex Orlenko 714dd6249f Enable Thread::reset for Luau 2022-03-23 21:13:48 +00:00
Alex Orlenko 9533f08d3a Use lua_xpush for Luau 2022-03-23 01:24:54 +00:00
Alex Orlenko 3a9c8c2da2 Add Luau vector datatype support 2022-03-22 21:14:06 +00:00
Alex Orlenko 55b778c68b Fix clippy warnings 2022-03-22 00:47:31 +00:00
Alex Orlenko 4e0ba6559e Add require function to Luau 2022-03-21 01:08:48 +00:00
Alex Orlenko 405cff5d49 Move StaticUserData* implementation from lua module to the new userdata_impl 2022-03-21 01:08:48 +00:00
Alex Orlenko 1e61d1dadc Return binary chunks support in safe mode.
Lua has many ways to load binary bytecode and this restriction was easy to bypass.
2022-03-21 01:08:47 +00:00
Alex Orlenko 32124b31a0 Move chunks structs to a new module.
Add Luau Compiler interface to compile sources.
2022-03-21 01:08:47 +00:00
Alex Orlenko 3e5f8e7bb8 Enable Lua::inspect_stack for Luau 2022-03-21 01:08:47 +00:00
Alex Orlenko eed7b1f3af More ffi module refactoring 2022-03-20 20:30:20 +00:00
Alex Orlenko c322e028e2 Initial Luau support 2022-03-20 20:30:20 +00:00
Alex Orlenko 6dc127f4eb Refactor ffi module
Initial Luau support work
2022-03-20 20:30:18 +00:00
Alex Orlenko 10826a7e67 Update create_registry_value doc 2022-02-15 19:45:37 +00:00
Alex Orlenko 18c3255c90 Optimize Lua::create_registry_value by reusing previously expired registry keys. 2022-02-14 21:20:57 +00:00
Alex Orlenko 6190427f37 Add Lua::replace_registry_value 2022-02-14 20:51:24 +00:00
Alex Orlenko 9a5a341e44 Recognize LuaJIT TCDATA type to generate correct panic message.
Relates to #127
Should be fixed in a next major release by adding support of TCDATA type.
2022-02-12 18:40:18 +00:00
Alex Orlenko dd91ebfbe5 Grow/check Lua stack in unpack 2022-02-12 17:10:43 +00:00
Alex Orlenko f9fe869b76 Optimize async calls:
Rewrite "unpack" function using C api rather than high level abstraction.
2022-01-29 12:39:30 +00:00
Alex Orlenko 5a06778fbc Always restore original Lua state after creating Future in async call.
Fixes #121
2022-01-16 20:57:43 +00:00
Alex Orlenko e33bdddc7a Pass Box wrapped pointer to allocator fn instead of reference 2022-01-08 23:06:01 +00:00
Alex Orlenko cfb5d3fd45 Fix clippy warnings 2021-12-28 12:23:06 +00:00
Alex Orlenko f1e357ce52 Hide (doc) into_static/from_static methods 2021-12-01 00:28:08 +00:00
Alex Orlenko be09a1fabf Update lifetimes for few functions in Lua 2021-11-30 23:14:08 +00:00
Alex Orlenko 2fee3e7891 Update docs 2021-11-25 18:01:41 +00:00
Alex Orlenko 1b74c89509 More performance optimizations 2021-11-25 11:16:12 +00:00
Alex Orlenko 066d28f5e5 Update Lua::unload doc & fix clippy warnings 2021-11-23 19:01:23 +00:00
Alexander Polakov d49757c7db Add unload() to remove module 2021-11-23 18:36:57 +03:00
Alex Orlenko 0e1be19cbb Move hook_proc under Lua::set_hook to use callback_error_ext 2021-11-16 12:27:56 +00:00
Alex Orlenko 0ef709672d Add set_warning_function/remove_warning_function/warning functions to Lua for 5.4
This utilizes Lua 5.4 warnings system (https://www.lua.org/manual/5.4/manual.html#pdf-warn)
2021-11-16 12:05:34 +00:00
Alex Orlenko 41503b4fb8 Update callback_error_ext (+ fix callback multi states handling) 2021-11-16 11:53:51 +00:00
Alex Orlenko 50f20e0c2c Add thread (coroutine) cache to reset and later reuse to execute async functions.
It works on Lua 5.4 and LuaJIT (vendored) with `lua_resetthread` function.
2021-11-14 23:19:47 +00:00
Alex Orlenko 63ea8c7662 Rename wrapped_failures pool to cache 2021-11-14 23:19:47 +00:00
Alex Orlenko 863d36d5a1 Performance optimization: cache and reuse MultiValue containers 2021-11-12 15:32:53 +00:00