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
26d8d899f2
Allocate Waker slot in Registry in re-use it (instead of creating new userdata for it)
2021-05-02 13:04:02 +01:00
Alex Orlenko
67bc0b1196
Make AsyncPollPending internal value as LightUserData
2021-05-02 12:06:32 +01:00
Alex Orlenko
e8505b5239
Change signature of Function::dump() to remove Result
2021-05-02 11:48:42 +01:00
Alex Orlenko
3f55958bdd
Stack assertions review
...
Other minor code and documentation updates
2021-05-02 11:42:03 +01:00
Alex Orlenko
463fc646bc
Refactor UserDataCell
2021-04-27 21:55:31 +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
269ef9c55d
Fix lua51 scope compilation
2021-04-27 10:11:37 +01:00
Alex Orlenko
f5b88624ce
Hide Deserializer inner fields
...
Improve documentation
2021-04-27 10:04:18 +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
c19f12898d
Replace lazy_static with once_cell
2021-04-27 00:29:38 +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
c10169a380
cargo fmt and other minor fixes
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
c95ac32741
Add inline(always) to some compat53 functions
2021-04-27 00:29:37 +01:00
Alex Orlenko
5a7ad9f7cd
Fix some clippy warnings & minor changes
2021-04-27 00:29:37 +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
cb1ac28f2a
v0.5.4
2021-04-20 02:05:05 +01:00
Alex Orlenko
0bd36b42e7
Make error::Error non_exhaustive
2021-04-16 22:10:10 +01:00
Alex Orlenko
e0da6ac929
Hide raw_sequence_values_by_len under async/serialize feature flags
2021-04-16 22:09:49 +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
c363fb9288
v0.5.3
2021-03-04 00:01:06 +00:00
Alex Orlenko
726fde7e1f
Optimise async callbacks (polling)
...
call async Rust callback [sum] 3 10
time: [59.338 us 59.729 us 60.097 us]
change: [-10.336% -8.6212% -6.8003%] (p = 0.00 < 0.05)
Performance has improved.
2021-03-03 23:21:56 +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
b93ace0224
v0.5.2
2021-02-27 19:32:25 +00:00
Alex Orlenko
5f37bf812d
Fix/whitelist some clippy warnings
2021-02-27 19:23:08 +00:00
Alex Orlenko
7775b4a99c
Bump copyright year
2021-02-26 10:35:00 +00:00
Alex Orlenko
1d9cda10eb
Add ToLua implementation for Cow<str> and Cow<CStr>
2021-02-26 10:23:36 +00:00
Alex Orlenko
7332c6a28c
Remove `registered_userdata_mt` check
2021-02-22 20:38:36 +00:00
Alex Orlenko
335f433df4
Optimize callbacks
2021-02-21 23:52:20 +00:00
Alex Orlenko
2aed548747
Fix scoped async destruction of partially polled futures
2021-02-21 23:52:07 +00:00
Alex Orlenko
aeb66115f7
v0.5.1
2021-01-20 11:04:03 +00:00
Alex Orlenko
b6ff501b8c
Fix numeric types conversion for 32bit lua. Fix #27
2021-01-20 10:46:23 +00:00
Alex Orlenko
e62fd400d7
Remove unused exports from glue.{c,rs} && Fix some clippy warnings
2021-01-16 13:31:45 +00:00
Alex Orlenko
618874ef3c
v0.5.0
2020-12-31 13:39:42 +00:00
Alex Orlenko
9f82cbe0c5
Update documentation
2020-12-31 13:39:38 +00:00
Alex Orlenko
bedd430eb5
Re-export mlua_derive
2020-12-29 22:26:15 +00:00
Alex Orlenko
afc41ab23c
Add serialization example & update others
2020-12-29 21:39:34 +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
Kai Schmidt
c65058a40a
impl `ToLua` and `FromLua` for `HashSet` and `BTreeSet`
2020-09-27 17:54:47 -07:00
Alex Orlenko
a172c021c9
Update `set_memory_limit` doc
2020-07-30 12:16:25 +01:00
Alex Orlenko
de2c5cd9a9
Fix compilation warnings on nightly rust
2020-07-28 21:10:55 +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
Eidolon
883bf082b9
Make Lua::load load binary chunks when unsafe
2020-07-27 03:37:38 -05:00
Alex Orlenko
4265250cfd
0.4.1 release
...
Fix docs.rs build features
Update Cargo.toml description
2020-06-08 14:08:07 +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
95b9fe8dac
Fix clippy warnings
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
Alex Orlenko
d5c22d989a
Dirty hack to get lua 5.1 main state
2020-06-06 16:07:16 +01:00
Alex Orlenko
a9a4cf13f1
Add `has_metamethod` to `AnyUserData`
2020-06-06 16:07:16 +01:00
Alex Orlenko
c3822219e0
Add hooks support (based on rlua v0.17 implementation)
...
This feature works on lua54, lua53, lua52 and lua51 only.
LuaJIT is unstable.
2020-06-06 16:07:16 +01:00
Alex Orlenko
f6da437d8b
Update docs
2020-06-06 16:07:16 +01:00
Alex Orlenko
2fd6757f39
Add LuaJIT 2.0.5 stable support
2020-06-06 16:07:16 +01:00
Alex Orlenko
cccec914ca
Remove deprecated Table::call
2020-05-15 01:48:57 +01:00
Alex Orlenko
687ecc9247
Update documentation
2020-05-15 01:48:57 +01:00
Alex Orlenko
79bfb112aa
Remove redundant lifetimes
2020-05-15 01:48:57 +01:00
Alex Orlenko
9f2d598517
Add clippy check and fix clippy warnings
2020-05-15 01:48:56 +01:00
Alex Orlenko
5a9a308790
Provide safe and unsafe Lua modes:
...
- In safe mode Lua would not have ability to load C code via `require` or `package.loadlib`
- Unsafe mode allows everything.
2020-05-12 02:14:48 +01:00
Alex Orlenko
1b2b94c808
Use Rust allocator for new Lua states that allows to set memory limit
2020-05-12 02:14:48 +01:00
Alex Orlenko
526e7418d8
Add MetaMethod::Close to support Lua 5.4 to-be-closed variables
2020-05-12 02:14:47 +01:00
Alex Orlenko
539b569ff4
Add Lua 5.4 (rc2) support
2020-05-11 02:43:34 +01:00
Alex Orlenko
5c226b4915
Lua 5.4 FFI
2020-05-11 02:43:34 +01:00
Alex Orlenko
d366ce0dd4
Scope support (including async)
2020-05-11 02:43:34 +01:00
Alex Orlenko
2bd5c2f6ca
Hide Lua "Send" capability under the optional "send" feature flag
2020-05-11 02:43:34 +01:00
Alex Orlenko
7b0e4b4280
Add Send capability to Lua
2020-05-11 02:43:34 +01:00
Alex Orlenko
6e2bb73cff
Bind Futures lifetimes to 'lua rather than 'static.
...
Fix async examples.
2020-05-11 02:43:34 +01:00
Alex Orlenko
7efcee853d
Don't allow 'callback outlive 'lua
2020-05-11 02:43:33 +01:00
Alex Orlenko
d672e19365
Add ToLua implementation for slices and arrays
2020-04-29 16:12:58 +01:00
Alex Orlenko
bda399a5b4
Get yield function in the moment of async callback creation.
...
This is usefull to temporary override `coroutine.yield` prior to create_async_callback()
and then restore to original value.
2020-04-28 14:29:36 +01:00
Alex Orlenko
fe5e87b0f5
Fix bugs with metatable cache:
...
- Don't use thread_local as Lua can be created in one thread and executed in another (in module mode);
- Make per state storage without luaL_ref;
2020-04-28 14:29:14 +01:00
Alex Orlenko
0efa0fcb6a
Update documentation
2020-04-20 01:52:01 +01:00
Alex Orlenko
c826798a6d
Minor refactor
2020-04-19 16:51:35 +01:00
Alex Orlenko
ee08050c1f
Add TableExt trait with call_method/function methods
2020-04-19 16:15:16 +01:00
Alex Orlenko
222f4df668
Add family of `call_async` function
...
Update documentation
Move async tests to a separate file
2020-04-18 21:26:12 +01:00
Alex Orlenko
47e8a80c1c
v0.3.0-alpha.1 with async support
...
Squashed commit of the async branch.
2020-04-17 22:39:50 +01:00
Alex Orlenko
1a788c48f1
Cherry-pick changes from rlua:
...
- Make Value::type_name() public
- Update CallbackError and ExternalError Display impl
2020-04-15 21:23:00 +01:00
Alex Orlenko
e4dc773aa3
Remove `__ipairs` metamethod deprecated in lua 5.3 and not available by default
2020-01-25 20:47:36 +00:00
Alex Orlenko
27121c779d
Add raw_insert() and raw_remove() for tables (represented as lists)
2020-01-07 20:53:47 +00:00
Alex Orlenko
5eec0ef56b
Implement PartialEq trait for Value (and subtypes)
...
Add equals() method to compare values optionally invoking __eq.
2020-01-07 00:03:03 +00:00
Alex Orlenko
42b33849e1
Add support of loading a specified set of standard libraries
2019-12-26 23:04:21 +00:00
Alex Orlenko
143c3a81a7
Add pair and ipair metamethods support (lua 5.2/5.3 only)
2019-11-30 00:58:42 +00:00
Alex Orlenko
fd17a01456
Add Lua 5.2 support
2019-11-30 00:58:41 +00:00
Alex Orlenko
ae677b0918
Move lua 5.1 support under new "lua51" feature
2019-11-04 22:23:15 +00:00
Alex Orlenko
6874c2e004
Fix examples and docs
2019-11-04 22:23:15 +00:00
Alex Orlenko
29aa25a48b
Dont take wrapped panic in error_tostring()
2019-11-04 22:23:09 +00:00
Alex Orlenko
85607d8bfc
Impl Drop for Lua
2019-10-17 17:05:42 +01:00
Alex Orlenko
ec08a76a41
Don't store extra data in the lua_State extra space
2019-10-17 17:05:42 +01:00
Alex Orlenko
c4fd7a9faf
Lua 5.1 support
2019-10-17 17:05:42 +01:00
Alex Orlenko
b7c578c274
Replace libc with std::os::raw
2019-10-02 22:12:28 +01:00
Alex Orlenko
224ed8ff52
Add mlua_derive proc macro module
2019-10-02 22:12:27 +01:00
Alex Orlenko
cb109f6e36
Rename to mlua
2019-10-01 16:11:12 +01:00