Alex Orlenko
1040c0a347
Fix typo
2022-10-22 23:44:21 +01:00
Alex Orlenko
967cbb53b0
Update compile tests
2022-08-23 23:12:37 +01:00
Alex Orlenko
44a8d86d8a
Fix error message in tests (luau)
2022-08-23 23:08:00 +01:00
Alex Orlenko
33278d4a64
Check if chunk is empty in luaL_loadbufferx for Luau ( fixes #200 )
2022-08-23 11:35:08 +01:00
Alex Orlenko
0cd724f63b
Fix Lua assertion when inspecting another thread stack.
...
The thread can be dead and it's not safe to call __tostring metamethod (if present) on error object.
Fixes #195
2022-08-01 22:07:39 +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
40fe937878
Fix a bug in `Function::bind` when args and binds are empty
...
This leads to a Lua assertion due to using wrong stack index
2022-07-22 00:24:53 +01:00
Alex Orlenko
70e16b51ae
Set source name to full file path in Luau require
2022-06-29 11:25:16 +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
a05a58b258
Update integer/number coercion logic
2022-05-30 19:26:12 +01:00
Alex Orlenko
62db3adde1
Add "send" test
2022-05-26 22:22:23 +01:00
Alex Orlenko
30ba616a8a
Correctly deserialize newtype struct ( #168 )
2022-05-24 23:26:17 +01:00
Alex Orlenko
0076aa735a
Add `Function::coverage` for Luau to obtain coverage report
2022-05-24 02:01:46 +01:00
Alex Orlenko
bcf2cbea37
Add `Value::to_pointer()` function.
...
Closes #165 and #166 .
2022-05-18 13:15:08 +01:00
Alex Orlenko
2a8c5c7f82
Refactor `Function::bind` implementation.
...
Make it possible to bind async function arguments.
Fixes #161
2022-05-15 01:15:31 +01:00
Alex Orlenko
1807fa789c
Don't require Lua sources for modules in build system
2022-05-07 22:16:54 +01:00
Alex Orlenko
5133a9837a
Add `Function::info()` to get information about functions.
...
Closes #149 and #7 .
2022-04-18 18:28:11 +01:00
Alex Orlenko
790df77965
Fix "unused" warning in tests
2022-04-17 22:39:21 +01:00
Sondre Aasemoen
a5ce0c1409
Add parking_lot dependency and feature
2022-04-16 19:45:21 +02: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
1ba7a409d5
Update compile tests
2022-04-13 14:30:52 +01:00
Alex Orlenko
ef81f40afa
Add tests for static Lua instance
2022-04-13 14:30:45 +01:00
Alex Orlenko
28a063c1e5
Implement Hash for Lua String
2022-04-08 20:02:18 +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
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
714dd6249f
Enable Thread::reset for Luau
2022-03-23 21:13:48 +00:00
Alex Orlenko
0a3b65af88
Support `readonly` table attribute (luau)
2022-03-22 21:33:29 +00:00
Alex Orlenko
3a9c8c2da2
Add Luau vector datatype support
2022-03-22 21:14:06 +00:00
Alex Orlenko
4e0ba6559e
Add `require` function to Luau
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
fa99f62a99
Fix __index and __newindex wrappers for Luau
2022-03-21 01:08:40 +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
Tarik02
d4f8dce597
Fix async userdata __index, __newindex metamethods
2022-03-20 20:03:47 +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
6e4033abba
Fix tests for Lua 5.4.4
2022-01-29 12:36:09 +00:00
Alex Orlenko
3b6564c02a
Update compile tests (messages)
2021-11-27 13:42:22 +00:00
Alex Orlenko
440862de38
Update tests
2021-11-23 19:12:27 +00:00
Alexander Polakov
d49757c7db
Add unload() to remove module
2021-11-23 18:36:57 +03:00
Alex Orlenko
170818c469
Add `call()` function to `TableExt` to call tables with `__call` metamethod as functions
2021-11-21 23:47:45 +00:00
Alex Orlenko
e2ebe65306
Add `get_named_user_value` and `set_named_user_value` to `AnyUserData`
2021-11-21 23:42:47 +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
8af1304fd0
Add `Lua::inspect_stack` to get information about the interpreter runtime stack.
...
This functionality is provided by `lua_getstack`.
2021-11-09 14:18:14 +00:00
Alex Orlenko
153502ec73
Add `set_nth_user_value` and `get_nth_user_value` to `AnyUserData`
...
with `n` up to 65535 for all Lua versions.
2021-11-08 21:16:31 +00:00
Alex Orlenko
204eedde3c
Merge branch 'dev'
2021-11-07 13:07:22 +00:00
Alex Orlenko
fbc2973aff
Fix recursive tables serialization when using `serde::ser::Serialize`
...
implementation for Table.
Fixes #98 .
2021-11-06 21:12:00 +00:00
Alex Orlenko
806f0bcef4
Add luajit52 support (LuaJIT with partial compatibility with Lua 5.2)
2021-11-04 12:26:11 +00:00
Alex Orlenko
d88a4282c7
Replace macro-based implementation `ToLua` for arrays to const generics
2021-11-04 00:59:39 +00:00
Alex Orlenko
d7d987fa14
Add async meta methods for all Lua except 51
2021-11-04 00:57:49 +00:00
Alex Orlenko
4d3ac6d8c5
Add new "application data" api
2021-10-19 11:45:39 +01:00
Alex Orlenko
559f9e6c6b
Add `target.aarch64-apple-darwin` conf to module examples
2021-10-11 18:07:34 +01:00
Alex Orlenko
a544e41b33
Add (hidden) method `UserData::take()` to take out value from userdata
2021-10-05 15:46:50 +01:00
Alex Orlenko
c8c64a1b5a
Add serializing i128/u128 types.
...
Fixes #81 .
2021-10-04 23:20:11 +01:00
Alex Orlenko
bdd3c923ba
Fix table traversal used in recursion detection.
...
This fixes serializing same table multiple times within a parent table.
2021-09-28 16:41:39 +01:00
Alex Orlenko
53f873a482
Update compile tests error messages
2021-09-16 00:49:17 +01:00
Alex Orlenko
fc1fe2c15e
Add `DeserializeOptions` struct to control deserializer behavior.
...
This solves #74 and provides a way to deserialize a Lua globals table.
2021-09-15 23:45:08 +01:00
Alex Orlenko
d906405818
Simplify interface of `hook::HookTriggers`
2021-08-18 18:49:17 +01:00
Alex Orlenko
9f02a9ca09
Add `Debug::event()` to the hook's Debug structure
2021-08-17 15:17:03 +01:00
Alex Orlenko
59253410bb
Update trybuild messages
2021-07-13 11:59:33 +01:00
Alex Orlenko
1fe583027b
Add new functions: `lua.load_from_function()` and `lua.create_c_function()`
...
This should be useful to register embedded C modules to Lua state.
Provides a solution for #61
2021-07-05 00:03:18 +01:00
Alex Orlenko
24bbd62564
Fix converting Lua sequence table to HashSet/BTreeSet
2021-06-25 01:49:09 +01:00
Alex Orlenko
e4daff8c16
Add limited recursion test to increase coverage
2021-06-21 12:30:17 +01:00
Alex Orlenko
242bdafa75
More tests for arc/rc wrapped userdata
2021-06-19 00:03:09 +01:00
Alex Orlenko
b84d1bd65f
Update test names
2021-06-18 23:13:56 +01:00
Alex Orlenko
bf286751fa
Improve code coverage
2021-06-17 00:47:15 +01:00
Alex Orlenko
3b94b4e86f
Implement Hash for RegistryKey. Closes #57
2021-06-16 12:12:42 +01:00
Alex Orlenko
6e52bb7e65
Fix clippy warnings && tests
2021-06-13 23:30:54 +01:00
Alex Orlenko
08ffeb0ca9
Improve module mode:
...
- Don't hide module function inside `luaopen_%` function.
- Raise Lua exception instead of panic if module function returns error.
2021-06-13 22:38:51 +01:00
Alex Orlenko
821f1125b6
Add `String::to_string_lossy`
2021-06-04 00:16:40 +01:00
Alex Orlenko
a944f4ad6f
Implement `UserData` for Rc<RefCell>/Arc<Mutex>/Arc<RwLock> wrappers
2021-06-03 16:42:55 +01:00
Alex Orlenko
e8de2a458a
Allow multiple entrypoints in a single module share the same Lua state.
...
Previously it would initialize different Lua instances.
Fixes #49 .
2021-05-18 20:07:34 +01:00
Alex Orlenko
3e03f4201c
Add chunk! macro support
2021-05-05 22:13:51 +01:00
Alex Orlenko
5293b8d6d2
Add `Thread::reset()` for luajit/lua54
2021-05-05 11:11:32 +01:00
Alex Orlenko
af67971e0d
Make `SerializeOptions` non_exhaustive.
...
Add builder implementation similar to `LuaOptions` to set individual options.
2021-05-03 22:33:12 +01:00
Alex Orlenko
0f4bcca7ce
Add `LuaOptions` to customize Lua/Rust behaviour.
...
The only option is `catch_rust_panics` to optionally disable catching Rust panics via pcall/xpcall.
2021-05-03 21:33:49 +01:00
Alex Orlenko
4af7bcf0d9
Implement ToLua/FromLua for Box<str> and Box<[T]>
2021-05-03 12:22:11 +01:00
Alex Orlenko
a4567cb5f7
Improve growing the auxiliary stack of the ref thread:
...
Try to double size first, if not fulfilled try halving in a loop till 0.
Fix unwinding after panic in ref_stack_pop.
Add test to check the stack exhaustion.
2021-05-02 23:26:02 +01:00
Alex Orlenko
e8505b5239
Change signature of Function::dump() to remove Result
2021-05-02 11:48:42 +01:00
Alex Orlenko
b5f1325f2f
Store nonstatic UserData pointer in self userdata (instead of metatable)
2021-04-27 17:06:37 +01:00
Alex Orlenko
2fae94586d
Remove Result from lua.null() and lua.array_metatable(). They never fail.
2021-04-27 00:38:13 +01:00
Alex Orlenko
bc81d1016f
Add SerializeOptions to to change default Lua serializer behaviour
2021-04-27 00:35:53 +01:00
Alex Orlenko
c7541ef7d3
More tests
2021-04-27 00:29:38 +01:00
Alex Orlenko
41a1a0d15a
Add more checks for destructed userdata in AnyUserData
2021-04-27 00:29:38 +01:00
Alex Orlenko
ced808d5ab
Don't trigger longjmp in rust.
...
Motivation behind this change is upcoming breaking change in Rust
compiler v1.52.0 to prevent unwinding across FFI boundaries.
https://github.com/rust-lang/rust/pull/76570
The new functionality requires nightly compiler to declare FFI
functions as "C-unwind".
The fundamental solution is to use C shim to wrap "e" and "m"
Lua functions in pcall.
Additionally define Rust calling convention to trigger lua_error
on Rust behalf.
2021-04-27 00:29:38 +01:00
Alex Orlenko
decb5b9e37
Make MetaMethod::name() public
...
Tests for UserDataMetatable::pairs()
2021-04-27 00:29:37 +01:00
Alex Orlenko
1635903d3f
Improve/fix scoped UserData drop
2021-04-27 00:29:37 +01:00
Alex Orlenko
2b2df708f9
Add `UserDataFields` API.
...
Provide safe access to UserData metatable and allow to define custom metamethods..
2021-04-27 00:29:37 +01:00
Alex Orlenko
e26cec5db9
Drop 'feature(link_args)' (removed from nightly). Don't run tests for LuaJIT 2.0.5
2021-04-16 22:27:28 +01:00
Alex Orlenko
0c7db4916c
Serialize only known (registered) userdata.
...
This reverts commit 7332c6a
.
Non-static userdata is a special case and can cause segfault if try to serialize it.
Now it should be safe, plus I added non-static userdata destructor to generate better error messages
in case of accessing destructed userdata.
2021-04-16 22:01:55 +01:00
Alex Orlenko
b9589491e4
Improve panic handling (check for twice resumed panics)
2021-04-15 23:04:36 +01:00