Alex Orlenko
c44463f030
Replace impl AsRef<str> with simple &str
2022-12-18 00:35:41 +00:00
Alex Orlenko
de38e299fc
Use impl AsRef<str> for userdata methods/fields instead of generic param.
...
Use `impl AsRef<str>` for module names and named registry values.
2022-12-18 00:35:41 +00:00
Alex Orlenko
7526773a90
Do not clear usevalues when taking value out of userdata.
...
It has big performance penalty.
Lua GC can collect uservalues when userdata is not referenced anymore.
2022-12-18 00:35:41 +00:00
Alex Orlenko
bf79d9e75d
Initial implementation of owned Lua types
2022-12-18 00:35:41 +00:00
Alex Orlenko
3aac7131ee
Add Iter metamethod for Luau (available from 0.526)
2022-05-09 14:34:10 +01:00
Alex Orlenko
a8fef51e86
(minor) Fix capturing variables in protect_lua closures
2022-04-08 21:15:57 +01:00
Alex Orlenko
ec1fa04085
Update docs
2022-03-25 00:43:54 +00:00
Alex Orlenko
c322e028e2
Initial Luau support
2022-03-20 20:30:20 +00:00
Alex Orlenko
2fee3e7891
Update docs
2021-11-25 18:01:41 +00:00
Alex Orlenko
e2ebe65306
Add get_named_user_value and set_named_user_value to AnyUserData
2021-11-21 23:42:47 +00:00
Alex Orlenko
153502ec73
Add set_nth_user_value and get_nth_user_value to AnyUserData
...
with `n` up to 65535 for all Lua versions.
2021-11-08 21:16:31 +00:00
Alex Orlenko
ad70ba54a5
Publish AnyUserData::take
2021-11-04 12:32:19 +00:00
Alex Orlenko
806f0bcef4
Add luajit52 support (LuaJIT with partial compatibility with Lua 5.2)
2021-11-04 12:26:11 +00:00
Alex Orlenko
d7d987fa14
Add async meta methods for all Lua except 51
2021-11-04 00:57:49 +00:00
Alex Orlenko
ed48b11e7f
Update documentation references
...
Using rustdoc links (see RFC https://github.com/rust-lang/rfcs/pull/1946 )
2021-10-12 00:49:45 +01:00
Alex Orlenko
a544e41b33
Add (hidden) method UserData::take() to take out value from userdata
2021-10-05 15:46:50 +01:00
Alex Orlenko
d586eef0f5
Refactor UserData metatables handling
2021-09-28 16:33:36 +01:00
Alex Orlenko
ee1c8a1a3d
Add inline attributes to few hot funcs
2021-09-28 16:19:29 +01:00
Alex Orlenko
1020315a9b
Update documentation about FromLua for UserData. Closes #64
2021-08-04 12:12:02 +01:00
Alex Orlenko
5fb7b96704
Replace custom UserDataRef(Mut) with standard Ref(Mut)
2021-07-13 10:53:10 +01:00
Alex Orlenko
17162b1e0b
UserData improvements:
...
1) Optimize `make_userdata` call
2) Refactor `UserDataWrapped` and make it enum
2021-07-11 01:30:17 +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
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
0bad4a0ff9
Fix spelling
2021-05-10 19:53:38 +01:00
Alex Orlenko
5293b8d6d2
Add Thread::reset() for luajit/lua54
2021-05-05 11:11:32 +01:00
Alex Orlenko
7541b6f3f3
Remove deprecated AnyUserData::has_metamethod()
2021-05-04 23:57:47 +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
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
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
9f82cbe0c5
Update documentation
2020-12-31 13:39:38 +00:00
Alex Orlenko
6e2b687cb7
Serde support (serialize feature flag)
2020-12-14 00:51:26 +00:00
Alex Orlenko
a9a4cf13f1
Add has_metamethod to AnyUserData
2020-06-06 16:07:16 +01:00
Alex Orlenko
687ecc9247
Update documentation
2020-05-15 01:48:57 +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
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
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
e4dc773aa3
Remove __ipairs metamethod deprecated in lua 5.3 and not available by default
2020-01-25 20:47:36 +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