Alex Orlenko
1ebb4b468a
Support 52-bit integers for Luau
...
Simply to float conversion (it actually never fails or goes out of range)
2025-03-13 16:18:44 +00:00
Radiant
b5d38ab2e3
Set Default for LuaValue to be nil. ( #512 )
2025-01-19 23:52:58 +00:00
Alex Orlenko
cd4091f64d
Allow exhaustive match on Value.
...
It was not possible because `ValueRef` variant in `Value::Other` was private.
Closes #502 and #503
2024-12-10 23:37:19 +00:00
Alex Orlenko
93a1a55aaa
Update docs
2024-10-19 23:10:43 +01:00
Alex Orlenko
08545224f4
clippy
2024-10-19 11:49:40 +01:00
Alex Orlenko
930fd9c00f
Fix Value::String::to_pointer for Lua < 5.4
2024-10-18 23:12:04 +01:00
Alex Orlenko
2a8db87132
Update Value tests
2024-10-18 22:50:48 +01:00
Alex Orlenko
179c54f297
Remove generic from Table::equals and Value::equals
2024-10-16 16:11:48 +01:00
Alex Orlenko
03a4068d55
Move MultiValue from value to multi module
2024-10-07 13:37:39 +01:00
Alex Orlenko
9f6c78532f
Move IntoLua/FromLua and IntoLuaMulti/FromLuaMulti to traits module
2024-10-07 10:32:50 +01:00
Alex Orlenko
4891b6535c
Remove const from Value::type_name
2024-10-06 22:45:56 +01:00
Alex Orlenko
a3ca95fc8f
Include Value::Other variant into Value::to_pointer() helper.
...
Closes #465
2024-10-04 10:33:56 +01:00
Alex Orlenko
ae4897ab2e
Add Value::is_error and Value::as_error helpers
2024-10-02 12:59:04 +01:00
Alex Orlenko
04d8106676
Remove SubtypeId from AnyUserData and instead add Value::Other variant that will cover any unknown types (eg. LuaJIT CData)
2024-10-02 12:16:48 +01:00
Alex Orlenko
4b8c26e682
Invoke __tostring metamethod when calling Value::to_string() for Buffer type
2024-10-01 22:59:19 +01:00
Alex Orlenko
529361fcbc
Add new Buffer type for Luau.
...
Previously it was represented as `AnyUserData` which is not always convenient.
2024-10-01 15:21:19 +01:00
Alex Orlenko
fce85381c6
Fix clippy warnings
2024-09-22 19:02:16 +01:00
Alex Orlenko
7957c6868d
Fastpath for LuaString/integer/float conversion from Lua
2024-09-07 12:25:35 +01:00
Alex Orlenko
66b4a865c2
Remove MultiValue pool
2024-08-26 11:26:12 +01:00
Alex Orlenko
10999babe0
Replace MultiValue::extend_from_values with from_lua_iter
2024-08-06 01:32:20 +01:00
Alex Orlenko
f0a995a357
Make MultiValue::with_capacity public
2024-08-05 23:36:17 +01:00
Alex Orlenko
aa47324ee9
Use pool for MultiValue container
2024-08-05 22:07:19 +01:00
Alex Orlenko
a86d6ab330
Mark LightUserData as Send+Sync (send feature flag)
2024-07-31 13:42:39 +01:00
Alex Orlenko
94415065c0
Fix Lua String soundness when borrowing &str or &[u8].
...
Make borrowing using new `BorrowedStr` and `BorrowedBytes` types that holds strong reference to Lua.
2024-07-31 13:42:38 +01:00
Alex Orlenko
b4892c228c
Add rustfmt.toml
2024-07-31 13:42:37 +01:00
Alex Orlenko
658f2a13ea
Support multi threads under send feature flag
2024-07-31 13:42:37 +01:00
Alex Orlenko
cd6d86a5ce
Split single lua module to multiple submodules under state
2024-07-31 13:42:37 +01:00
Alex Orlenko
7221051683
Refactor:
...
- Remove the rest of `'lua` lifetimes
- Remove Owned types
2024-07-31 13:42:35 +01:00
Alex Orlenko
1eb2ecb3b0
Drop lifetime from IntoLua
2024-07-31 13:42:35 +01:00
Alex Orlenko
aa05eb4c81
Switch MultiValue to use VecDeque under the hood.
2024-07-31 13:42:35 +01:00
Alex Orlenko
4aa178fcc0
Take &Value in Lua::push_value()
2024-07-31 13:42:35 +01:00
Alex Orlenko
98ca880f8a
Change Value::Error variant to store Box<Error> instead of Error.
...
This will help to reduce size of `Value` enum on the stack.
2024-07-31 13:42:34 +01:00
Yiyu Lin
b62f2ee0f7
chore: make clippy happy ( #388 )
...
Co-authored-by: hzlinyiyu <hzlinyiyu@corp.netease.com >
2024-03-25 13:26:06 +00:00
Alex Orlenko
34476ebf53
Support LuaJIT cdata type (produced by ffi module)
2023-11-16 13:33:23 +00:00
Alex Orlenko
5043447f23
Support Luau buffer type and and library.
...
Buffer is an object that represents a fixed-size mutable block of memory and added to Luau 0.601.
See https://luau-lang.org/library#buffer-library for more details.
2023-11-16 12:55:58 +00:00
Alex Orlenko
052310e93d
Update doc for deny_unsupported_types option
2023-08-12 17:40:39 +01:00
Alex Orlenko
09eb7f251b
Support options for Value::serialize() implementation
...
To match `lua.from_value_with()` functionality.
2023-08-12 17:24:57 +01:00
Alex Orlenko
0cb0a345dd
Hide clippy warning converting i32 to i32
2023-08-07 11:44:35 +01:00
Alex Orlenko
3e479be4e5
Cosmetic changes for the Value conversions + add tests
2023-08-06 23:41:27 +01:00
Akase Cho
021ee946fc
Add helper functions to Value ( #299 )
...
Add helper functions to `Value`
2023-08-06 22:44:32 +01:00
Alex Orlenko
cd0c8a4584
Optimize async functionality:
...
Rewrite using the new `push_into_stack()`/`from_stack()` methods.
Also store thread state (pointer) in `Thread` struct to avoid getting it every time.
Async userdata methods still need to have arguments stored in ref thread as stack is empty on every poll().
2023-08-03 00:56:17 +01:00
Alex Orlenko
4fff14a144
impl Drop for MultiValue
...
This action would automatically return container to the pool on drop (instead of doing it manually)
2023-08-01 11:21:26 +01:00
Alex Orlenko
196c09a0d6
New (unsafe and private) methods for IntoLua/FromLua traits: push_into_stack/from_stack.
...
They allow to push Value directly to Lua stack or get Value from Lua stack without creating MultiValue container.
This approach is a big optimization opportunity and already demonstrated great results.
For instance, obtaining `&T` for userdata methods are now work directly from stack value without copying to auxiliary stack.
2023-07-31 22:13:23 +01:00
Alex Orlenko
4daa631178
Set __type metatable field for Luau instead of __name.
...
Other Lua versions continue to use `__name` field.
Also make `MetaMethod` enum non-exhaustive (and add `Type` variant)
Closes #295
2023-07-26 21:43:26 +01:00
Alex Orlenko
128c357e07
Use __tostring if __name is not available when pretty printing userdata values
2023-07-11 21:36:02 +01:00
Alex Orlenko
541139b944
Change Lua ref types Debug print from Ref{index} to Ref{pointer}
...
The index is always uniq per instance, but pointer can exactly tell when
several values reference to the same Lua internal value.
2023-07-08 12:52:14 +01:00
Alex Orlenko
1f0e81c9a1
Add a dedicated type for Luau vector.
...
Refactor existing implementation and add 4-dimensional vectors support.
2023-06-20 13:30:42 +01:00
Alex Orlenko
b674d7906d
Include (known) userdata type to Value debug pretty-print
2023-05-28 01:12:42 +01:00
Alex Orlenko
4306e6e978
Add Value::to_string() method similar to luaL_tolstring.
...
It uses `__tostring` metamethod if set.
Closes #279
2023-05-27 01:29:08 +01:00
Alex Orlenko
d951cb503f
Add Value::NULL constant
2023-05-06 22:53:40 +01:00