Commit graph

920 commits

Author SHA1 Message Date
Alex Orlenko 56b6b128b5
Minor fixes/compilation after revert 2021-07-08 22:53:53 +01:00
Alex Orlenko 1731f5d61b
Revert "Make protect_lua as a smart macro to choose from C/closure"
This reverts commit 84fe5f7f76.
2021-07-08 18:41:10 +01:00
Alex Orlenko 60822d12d2
Revert "Move away from metatable hashmap cache to direct keys"
This reverts commit adbc9ccc9b.
2021-07-08 18:40:14 +01:00
Alex Orlenko 8ff610529b
Don't wrap ExtraData to Arc<Mutex> and use raw pointer instead.
This causes serious performance issues and given that Lua is
single threaded (not Sync) it's safe to use a raw pointer instead.
2021-07-08 17:32:20 +01:00
Alex Orlenko adbc9ccc9b
Move away from metatable hashmap cache to direct keys 2021-07-08 15:37:18 +01:00
Alex Orlenko 84fe5f7f76
Make protect_lua as a smart macro to choose from C/closure 2021-07-07 12:54:19 +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 7b5b78fa3d
Add codecov.yml to don't fail on coverage change 2021-06-30 21:52:50 +01:00
Alex Orlenko 41aae83304
Optimize callback creation
Attach only one upvalue to callbacks rather than two.
This leads to less lookup to Lua registry.
2021-06-30 16:50:50 +01:00
Alex Orlenko fc84e8623e
v0.6.1 2021-06-28 00:10:07 +01:00
Alex Orlenko 8aae9a7c3e
Update chunk! documentation 2021-06-28 00:10:04 +01:00
Alex Orlenko 24bbd62564
Fix converting Lua sequence table to HashSet/BTreeSet 2021-06-25 01:49:09 +01:00
Alex Orlenko 30af919931
Lower once_cell dependency to 1.0 2021-06-25 00:39:10 +01:00
Alex Orlenko 89b5981c59
Fix typos 2021-06-25 00:38:49 +01:00
Alex Orlenko 7feabffc37
v0.6.0 2021-06-21 23:19:56 +01:00
Alex Orlenko f24fdfdb80
Update AsChunk::env function prototype 2021-06-21 23:19:33 +01:00
Alex Orlenko c702c5eff2
Add userdata example 2021-06-21 20:28:14 +01:00
Alex Orlenko e4daff8c16
Add limited recursion test to increase coverage 2021-06-21 12:30:17 +01:00
Alex Orlenko 8d474bbf8d
Fix clippy warning 2021-06-21 03:25:21 +01:00
Alex Orlenko 9e3b0ecc1e
Even better optimization after 14d5c2c887 2021-06-20 19:48:33 +01:00
Alex Orlenko 42b396d0d1
Optimize non-wrapped userdata method calls 2021-06-20 12:38:47 +01:00
Alex Orlenko 14d5c2c887
Lua->Rust callback performance improvements 2021-06-20 00:24:53 +01:00
Alex Orlenko b84c10fde6
Update README (include publishing to luarocks section) 2021-06-19 15:00:04 +01:00
Alex Orlenko b49f9539b6
Update CHANGELOG 2021-06-19 14:59:32 +01:00
Alex Orlenko a208156ed2 Update examples to include chunk! macro 2021-06-19 14:41:48 +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 4e92ea341b Fix userdata memleak in edge case.
This can happen if we unable to push metatable with `__gc` metamethod after pushing userdata.
In this case Lua will never execute drop.
Instead, we will push metatable first and then userdata.
2021-06-18 17:45:20 +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 9f0378b77e Complitely remove the C shim 2021-06-16 22:21:45 +01:00
Alex Orlenko d3f44354e0 Revert commit ced808d5ab
I think this experiment is unsuccessful and does not work well in a module mode
with dynamic symbols resolution and mixing between different mlua instances.
Overall the Rust bug has been fixed and we can wait for the "C-unwind" feature become stable.
2021-06-16 22:13:01 +01:00
Alex Orlenko fca21d56d3 Check stack in entrypoint1 before pushing value to a stack 2021-06-13 23:30:56 +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 3b9d8a7b5f Keep all Lua symbols in unsafe mode to load C modules 2021-06-12 18:00:55 +01:00
Alex Orlenko 0fe898c0dd v0.6.0-beta.3 2021-06-04 12:38:09 +01:00
Alex Orlenko 821f1125b6 Add String::to_string_lossy 2021-06-04 00:16:40 +01:00
Alex Orlenko 6c0096d8ac Update examples 2021-06-03 23:52:29 +01:00
Alex Orlenko abb95c3c56 Remove T: Clone requirement from add_async_function 2021-06-03 23:21:00 +01:00
Alex Orlenko 64faebf407 Add __ipairs metamethod (again) for Lua 5.2 only 2021-06-03 18:43:29 +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 bae424672a Treat errors as Send + Sync to be compatible with anyhow crate 2021-05-31 11:05:51 +01:00
Alex Orlenko 6f9eb82649 Update README 2021-05-18 20:13:28 +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 973b5c3bf5 v0.6.0-beta.2 2021-05-13 23:10:19 +01:00
Alex Orlenko b610a79d66 Update docs & minor error handling code changes 2021-05-11 14:18:22 +01:00
Alex Orlenko fe39ae09bf Try different approach for errors handling.
Instead of convering error to CallbackError in error message handler,
do it earlier at callback_error stage.
Better fix for #44.
2021-05-11 00:53:07 +01:00
Alex Orlenko 01714d2510 Prepare 0.6.0-beta.2 release 2021-05-10 22:28:33 +01:00
Alex Orlenko 0bad4a0ff9 Fix spelling 2021-05-10 19:53:38 +01:00