Commit graph

680 commits

Author SHA1 Message Date
delta aede7c726c Replace CallbackError display message 2022-12-01 19:34:15 +01:00
Alex Orlenko 6807dfa22e
v0.8.6 2022-11-07 01:05:14 +00:00
Alex Orlenko f27c49f931
Fix bug when recycled Registry slot can be set to Nil.
This can result in allocating the same slot twice and rewriting old value.
Lua uses (registry) table length to find next free slot and having Nil in the middle of the table can impact length calculation.
With this fix we ensure that Nil values uses a special LUA_REFNIL slot.
2022-11-07 00:10:57 +00:00
Alex Orlenko 693a808b6e
v0.8.5 2022-10-30 12:31:26 +00:00
Alex Orlenko a6ca65aa74
Better checks and tests when trying to modify a Luau readonly table 2022-10-30 11:41:09 +00:00
Alex Orlenko a7278cab78
Fix Table::raw_push for luau when readonly 2022-10-29 23:02:19 +01:00
Alex Orlenko e1bbd00a33
Fix getting caller information from Lua::load 2022-10-28 10:43:05 +01:00
Alex Orlenko e98998d6ac
Add push/pop methods to Table 2022-10-23 23:27:17 +01:00
Alex Orlenko cca177df5b
Minor serde optimizations 2022-10-23 03:13:24 +01:00
Alex Orlenko 65396a910f
Optimize Lua::create_table to use reference thread if possible 2022-10-23 00:24:04 +01:00
Alex Orlenko de69d10d73
Optimize Lua::create_string to use reference thread if possible 2022-10-23 00:14:13 +01:00
Alex Orlenko 959e61b97c
Optimize tables:
- Use reference thread directly for simple cases
- Fix issue when calling raw_set on readonly table (Luau)
- Add fasttrack methods for get/set/len when metatable is not set
2022-10-22 23:45:58 +01:00
Alex Orlenko 9045419586
Strings optimizations: get access to bytes directly from ref thread. 2022-10-22 23:43:08 +01:00
Alex Orlenko fcd162f3eb
Replace Lua::ref_thread_exec 2022-10-22 23:39:49 +01:00
Alex Orlenko 0354703dbf
Update formatting (Lua registry values) 2022-10-22 23:34:19 +01:00
Alex Orlenko 9831d0e397
Check that allocation does not exceed isize::MAX
See https://github.com/rust-lang/rust/issues/101899
2022-10-22 23:13:02 +01:00
Alex Orlenko 7f14d93c2b
v0.8.4 2022-10-09 14:40:15 +01:00
Alex Orlenko 29c6c9cb58
Fix clippy warnings 2022-10-09 14:08:33 +01:00
Alex Orlenko e01af22bac
Update push_userdata_ref 2022-10-09 13:56:30 +01:00
Alex Orlenko cfa959e599
Don't allocate extra byte for userdata (luau) 2022-10-09 13:56:06 +01:00
Alex Orlenko e523fb2c86
Update to Luau 0.548 (luau-src >=0.4) 2022-10-08 23:34:47 +01:00
Alex Orlenko 050ac4f5ad
Add luaL_setfuncs to preserved functions 2022-09-05 23:13:06 +01:00
Alex Orlenko 33278d4a64
Check if chunk is empty in luaL_loadbufferx for Luau (fixes #200) 2022-08-23 11:35:08 +01:00
Trisha 20a16839aa
Fix typo in doc comment 2022-08-23 01:47:17 +01:00
Alex Orlenko 83ed442bf9
v0.8.3 2022-08-02 12:43:15 +01:00
Alex Orlenko bf6708ba58
Fallback to Lua internal allocator if unable to create Lua VM with Rust one.
This should fix #194
2022-08-02 10:35:39 +01:00
Alex Orlenko 0cd724f63b
Fix Lua assertion when inspecting another thread stack.
The thread can be dead and it's not safe to call __tostring metamethod (if present) on error object.
Fixes #195
2022-08-01 22:07:39 +01:00
Alex Orlenko 5330b900fd
Check that Lua state is non-null in init_from_ptr() 2022-08-01 15:21:14 +01:00
Alex Orlenko ee32dc33f3
Check that lua_newstate() returns non-null Lua state 2022-08-01 12:56:36 +01:00
Alex Orlenko ab029b087d
Close to-be-closed variables for Lua 5.4 when using call_async functions
Fixes #192
2022-07-31 15:33:02 +01:00
Alex Orlenko 185fee956d
v0.8.2 2022-07-25 14:23:25 +01:00
Alex Orlenko 95adf8df8e
Add __iter to destructed metatable (luau) 2022-07-24 11:55:36 +01:00
Alex Orlenko 4a25eab257
Merge pull request #189 from hack3ric/master
`Function::bind`: simply clone the function if args are empty `MultiValue`
2022-07-22 00:28:18 +01:00
Alex Orlenko 40fe937878
Fix a bug in Function::bind when args and binds are empty
This leads to a Lua assertion due to using wrong stack index
2022-07-22 00:24:53 +01:00
Eric Long a6b178328d
Merge branch 'master' of https://github.com/hack3ric/mlua 2022-07-21 20:55:28 +08:00
Eric Long f3f173fcb6
Function::bind: simply clone the function if args are empty MultiValue 2022-07-21 20:54:49 +08:00
Alex Orlenko d3b48cf2f3
Use Luau tags to mark userdata objects as destructed 2022-07-18 10:38:22 +01:00
Alex Orlenko f9ff6116db
Use MaybeUninit instead of hack in protect_lua_closure 2022-07-17 11:33:51 +01:00
Alex Orlenko f75af6d75f
Fix clippy warnings 2022-07-17 11:11:30 +01:00
Alex Orlenko 059e41bafb
Optimize WrappedFailure userdata detection.
This is done by comparing a metatable pointer to previously saved one (it never changes).
2022-07-17 11:00:46 +01:00
Alex Orlenko f7ee6dc635
Add lua_xpush to 5.1-5.4 2022-07-17 11:00:46 +01:00
Eric Long 553251761f
Add MultiValue::get & add clear error in Index 2022-07-01 01:59:40 +08:00
Alex Orlenko b46b476f80
v0.8.1 2022-06-29 15:41:22 +01:00
Alex Orlenko 70e16b51ae
Set source name to full file path in Luau require 2022-06-29 11:25:16 +01:00
Alex Orlenko 9596b97faa
Update Lua::create_userdata doc about sharing metatable.
Closes #175
2022-06-29 00:25:26 +01:00
Alex Orlenko 8cbb3d8fae
Merge pull request #180 from khvzak/userdata_proxy
Add Lua::create_proxy for easy access to UserData static fields and f…
2022-06-29 00:05:59 +01:00
Alex Orlenko e7f494530f
Add Lua::create_proxy for easy access to UserData static fields and functions
Closes #178
2022-06-28 23:03:29 +01:00
Alex Orlenko 3746c3614f
Merge pull request #179 from hack3ric/master
Implement utilities for MultiValue
2022-06-28 22:56:28 +01:00
Alex Orlenko 9af1aaf889
Make clippy happy 2022-06-28 21:28:48 +01:00
Eric Long c20eb20a59
Implement utilities for MultiValue 2022-06-29 01:21:32 +08:00