summaryrefslogtreecommitdiff
path: root/src/lua.rs
AgeCommit message (Collapse)Author
2021-09-28Make `protect_lua` as a smart macro to choose from C/closureAlex Orlenko
2021-09-28Perf optimization: refactor metatable cacheAlex Orlenko
2021-09-15Add `DeserializeOptions` struct to control deserializer behavior.Alex Orlenko
This solves #74 and provides a way to deserialize a Lua globals table.
2021-08-21Wrap `ExtraData` to `Arc<UnsafeCell>>` instead of raw pointer and attach ↵Alex Orlenko
finalizer. This would allow to properly deallocate memory in module mode when closing lua state.
2021-08-19Change `ExtraData::mem_info` to `Box<MemoryInfo>`Alex Orlenko
2021-08-18Simplify interface of `hook::HookTriggers`Alex Orlenko
2021-08-17Clarify about calling `Lua::init_from_ptr()` multiple timesAlex Orlenko
2021-07-13Shrink unsafe block in `Lua::load_from_function` and update docAlex Orlenko
2021-07-11UserData improvements:Alex Orlenko
1) Optimize `make_userdata` call 2) Refactor `UserDataWrapped` and make it enum
2021-07-09Forgotten optimization for `box_method_mut`Alex Orlenko
2021-07-09Combine WrappedError and WrappedPanic structs to WrappedFailure enumAlex Orlenko
2021-07-08Rename init_gc_metatable_for and get_gc_metatable_forAlex Orlenko
2021-07-08Minor fixes/compilation after revertAlex Orlenko
2021-07-08Revert "Make `protect_lua` as a smart macro to choose from C/closure"Alex Orlenko
This reverts commit 84fe5f7f761e5a9669ae00df3f6e48ef2814272c.
2021-07-08Revert "Move away from metatable hashmap cache to direct keys"Alex Orlenko
This reverts commit adbc9ccc9be5d24ff56275938aebb11529ec7399.
2021-07-08Don't wrap ExtraData to Arc<Mutex> and use raw pointer instead.Alex Orlenko
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-08Move away from metatable hashmap cache to direct keysAlex Orlenko
2021-07-07Make `protect_lua` as a smart macro to choose from C/closureAlex Orlenko
2021-07-05Add new functions: `lua.load_from_function()` and `lua.create_c_function()`Alex Orlenko
This should be useful to register embedded C modules to Lua state. Provides a solution for #61
2021-06-30Optimize callback creationAlex Orlenko
Attach only one upvalue to callbacks rather than two. This leads to less lookup to Lua registry.
2021-06-21Update `AsChunk::env` function prototypeAlex Orlenko
2021-06-20Even better optimization after 14d5c2c887Alex Orlenko
2021-06-20Optimize non-wrapped userdata method callsAlex Orlenko
2021-06-20Lua->Rust callback performance improvementsAlex Orlenko
2021-06-18Fix userdata memleak in edge case.Alex Orlenko
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-17Improve code coverageAlex Orlenko
2021-06-16Revert commit ced808d5abAlex Orlenko
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-13Check stack in entrypoint1 before pushing value to a stackAlex Orlenko
2021-06-13Improve module mode:Alex Orlenko
- Don't hide module function inside `luaopen_%` function. - Raise Lua exception instead of panic if module function returns error.
2021-06-12Keep all Lua symbols in unsafe mode to load C modulesAlex Orlenko
2021-06-03Remove `T: Clone` requirement from `add_async_function`Alex Orlenko
2021-06-03Implement `UserData` for Rc<RefCell>/Arc<Mutex>/Arc<RwLock> wrappersAlex Orlenko
2021-05-18Allow multiple entrypoints in a single module share the same Lua state.Alex Orlenko
Previously it would initialize different Lua instances. Fixes #49.
2021-05-10Fix spellingAlex Orlenko
2021-05-05Add chunk! macro supportAlex Orlenko
2021-05-05Update lua state when polling futuresAlex Orlenko
2021-05-03Update code docsAlex Orlenko
2021-05-03Add `LuaOptions` to customize Lua/Rust behaviour.Alex Orlenko
The only option is `catch_rust_panics` to optionally disable catching Rust panics via pcall/xpcall.
2021-05-03Implement/Derive `Debug` for Lua and few other structsAlex Orlenko
2021-05-03Store `safe` property in Extra state to inherit into Lua structs made from ↵Alex Orlenko
pointers
2021-05-02Improve growing the auxiliary stack of the ref thread:Alex Orlenko
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-02Allocate Waker slot in Registry in re-use it (instead of creating new ↵Alex Orlenko
userdata for it)
2021-05-02Make AsyncPollPending internal value as LightUserDataAlex Orlenko
2021-05-02Stack assertions reviewAlex Orlenko
Other minor code and documentation updates
2021-04-27Refactor UserDataCellAlex Orlenko
2021-04-27Add more checks for destructed userdata in AnyUserDataAlex Orlenko
2021-04-27Don't trigger longjmp in rust.Alex Orlenko
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-27Fix some clippy warnings & minor changesAlex Orlenko
2021-04-27Add `UserDataFields` API.Alex Orlenko
Provide safe access to UserData metatable and allow to define custom metamethods..
2021-04-16Serialize only known (registered) userdata.Alex Orlenko
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.