Commit Graph

1134 Commits

Author SHA1 Message Date
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 14169eadb1 Include nightly to github CI tests 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 3e7f25670a Don't read lua.h from build script (was not used) 2021-04-20 02:05:00 +01:00
Alex Orlenko 0d404ce4c3 Don't fail CI on coverage 2021-04-16 22:43:21 +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 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 58cb371f06 Add rerun-if-changed instructions to build script 2021-04-14 22:33:23 +01:00
Alex Orlenko 8add60b019 Don't check LUA_LIB_NAME if it's not needed 2021-04-14 22:25:49 +01:00
Alex Orlenko c363fb9288 v0.5.3 2021-03-04 00:01:06 +00:00
Alex Orlenko 3900e23839 Fix compilation warnings on nightly 2021-03-03 23:36:28 +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 1f7e760d20 Add codecov coverage report 2021-02-27 18:03:53 +00:00
Alex Orlenko 90bea4aa34 Update README and keywords 2021-02-27 13:28:47 +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 94670e3fdb rustfmt 2021-02-22 20:13:56 +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 6a77b5f003 Update benchmarks:
- Refactor
- Add async benchmarks
2021-02-21 18:48:45 +00:00
Alex Orlenko aeb66115f7 v0.5.1 2021-01-20 11:04:03 +00:00
Alex Orlenko ce873a40bf Update CHANGELOG 2021-01-20 11:00:47 +00:00
Alex Orlenko 8de75d1c18 Update tokio to 1.0 for async examples 2021-01-20 10:47:27 +00:00
Alex Orlenko b6ff501b8c Fix numeric types conversion for 32bit lua. Fix #27 2021-01-20 10:46:23 +00:00
Alex Orlenko 0e73ae18f4 Update CI 2021-01-16 13:32:38 +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 1c79f646de Update README 2021-01-16 13:31:34 +00:00
Alex Orlenko 7f5fd36a2b
Merge pull request #26 from wez/cross
Support cross compilation
2021-01-14 15:35:35 +00:00
Wez Furlong faf19e4a06 Allow luajit to build in the pointer size cross compilation case 2021-01-13 20:01:12 -08:00
Wez Furlong 24d9099ef7 install more bits for cross compilation jobs 2021-01-13 10:38:08 -08:00
Wez Furlong 84003f31e7 Add CI for cross compilation cases 2021-01-13 10:18:53 -08:00
Wez Furlong e0d9ec41e2 Support cross compilation
This commit teaches the build script to recognize when it is
cross-compiling and switch to an alternative approach for generating
the `glue.rs` module.

It defaults to the equivalent logic found in the lua headers to
set the default types and parameters.

Notably: it doesn't statically produce the default lua paths as we
cannot know these without either executing the code (not guaranteed
possible when cross compiling) or regexing out the paths from the
headers (a bit brittle).  An alternative approach might be to use
something like `lazy_static` to ask the library for its compiled in
values once at runtime.

I've tested this with:

```
cargo build --target armv7-unknown-linux-gnueabihf --features lua51,vendored
cargo build --target armv7-unknown-linux-gnueabihf --features lua52,vendored
cargo build --target armv7-unknown-linux-gnueabihf --features lua53,vendored
cargo build --target armv7-unknown-linux-gnueabihf --features lua54,vendored
cargo build --target armv7-unknown-linux-gnueabihf --features luajit,vendored
```

All except luajit compile.  Luajit itself doesn't cross compile, so I
don't think we can ever reasonably get that to work.

I haven't tried to run any of this yet; my use case is actually for mac
(https://github.com/wez/wezterm/pull/426) so I need to commit this and
try patching it in over there before I can see if that truly worked
end-to-end.

refs: https://github.com/khvzak/mlua/issues/14
2021-01-13 09:55:53 -08: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 1a81f8d447 Update compile tests 2020-12-29 23:20:06 +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 c5d0ccc433 Add `reqwest` http client example to fetch json 2020-12-28 15:21:45 +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 368c4428eb Wider lua-src and luajit-src versions 2020-12-14 00:51:35 +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 68378a3957
Merge pull request #15 from kaikalii/master
impl `ToLua` and `FromLua` for `HashSet` and `BTreeSet`
2020-09-28 23:14:17 +01:00
Kai Schmidt c65058a40a impl `ToLua` and `FromLua` for `HashSet` and `BTreeSet` 2020-09-27 17:54:47 -07:00
Alex Orlenko 93d63cef35 v0.4.2 2020-08-17 12:17:08 +01:00
Alex Orlenko b743245aba Update CHANGELOG 2020-08-17 11:14:40 +01: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
Alex Orlenko 5c8a5e0a5a
Merge pull request #9 from HybridEidolon/bytecode-chunks
Make Lua::load load binary chunks when unsafe
2020-07-27 14:19:33 +01:00
Alex Orlenko e07c53eafe Update compile tests (2) 2020-07-27 13:51:21 +01:00
Alex Orlenko ad619390e1 Run compile tests on macos (was ubuntu-18.04) 2020-07-27 11:34:48 +01:00
Alex Orlenko 350602ab6e Update `lua-src` dependency to 5.4.0 2020-07-27 10:52:28 +01:00
Alex Orlenko 4b1bc88273 Update compile tests 2020-07-27 10:49:01 +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 1d9fed2207 0.4.0 release 2020-06-08 02:28:26 +01:00
Alex Orlenko a67cbafff1 Run LuaJIT 2.0.5 tests in 1 thread
Seems there is a race in a LuaJIT 2.0 that makes the tests unstable.
Works ok on LuaJIT 2.1 and all Lua.
2020-06-08 02:19:53 +01:00
Alex Orlenko 39bcb19ae7 Update dependencies 2020-06-08 00:22:53 +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 2595fe9885 Update CHANGELOG 2020-06-07 20:38:19 +01:00
Alex Orlenko 4865089a78 Update README 2020-06-07 20:38:19 +01:00
Alex Orlenko a35b8dda68 Raise compile_error! instead of panic! in the build script 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 73c7c94d75 Remove default feature `lua53` 2020-06-06 16:07:16 +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 56407fac0d Update CHANGELOG 2020-06-06 16:07:13 +01:00
Alex Orlenko d0fa03e9c8 Bump version to 0.4.0-beta.1 2020-06-06 16:05:35 +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 60c659ecff Add async http server example 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 1492790ece Update compile tests to include async/send features 2020-05-12 03:16:29 +01:00
Alex Orlenko e88f086ed8 Update github workflow 2020-05-12 02:14:48 +01:00