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
Alex Orlenko
3900e23839
Fix compilation warnings on nightly
2021-03-03 23:36:28 +00:00
Alex Orlenko
7cb9c4f39c
Fix bug in returning nil-prefixed multi values from async function
2021-03-03 22:32:22 +00:00
Alex Orlenko
2aed548747
Fix scoped async destruction of partially polled futures
2021-02-21 23:52:07 +00:00
Alex Orlenko
1a81f8d447
Update compile tests
2020-12-29 23:20:06 +00:00
Alex Orlenko
ce8955f5b9
Don't try to disable c modules without package loaded. Fix #24
2020-12-22 23:05:08 +00:00
Alex Orlenko
6e2b687cb7
Serde support (serialize feature flag)
2020-12-14 00:51:26 +00:00
Alex Orlenko
661f8e592a
Update num-traits dependency
...
Fix f32-to-f64 conversion tests
2020-11-04 21:22:24 +00:00
Alex Orlenko
c8a7aa947c
Update compile tests (temporary set TRYBUILD=overwrite)
2020-10-27 23:39:52 +00:00
Alex Orlenko
a52135b62d
Update compile tests error messages
2020-09-28 23:24:53 +01:00
Alex Orlenko
d201beadc9
Add ChunkMode enum to mark chunks as text or binary
2020-07-28 21:04:21 +01:00
Alex Orlenko
dd58cdad52
Add Function::dump() to dump lua function to a binary chunk
2020-07-27 23:26:33 +01:00
Alex Orlenko
e07c53eafe
Update compile tests (2)
2020-07-27 13:51:21 +01:00
Alex Orlenko
4b1bc88273
Update compile tests
2020-07-27 10:49:01 +01:00
Alex Orlenko
efcaef3db7
Enable hooks support for LuaJIT
2020-06-07 20:38:19 +01:00
Alex Orlenko
0a13a9631d
Fix LuaJIT 2.1 libraries loading
2020-06-07 20:38:19 +01:00
Alex Orlenko
3d42bc4ca6
Refactor main_state handling
...
Don't allow to set hook if main_state is not available
Remove Lua 5.1 dirty hack
2020-06-07 20:38:19 +01:00
Alex Orlenko
2eb40deafd
Add test to check loading module from lua coroutine (thread)
2020-06-07 20:38:19 +01:00
Alex Orlenko
5952a1f709
New module feature
...
Don't link module with Lua core (see: http://lua-users.org/wiki/BuildingModules )
Example and tests for modules
2020-06-07 20:38:11 +01:00