Commit Graph

69 Commits

Author SHA1 Message Date
Alex Orlenko 5dc6c3214b Prepare for 2024 edition 2025-05-06 21:28:21 +01:00
Alex Orlenko 8b7a85076a mlua-sys: Prepare to 2024 edition 2025-05-06 15:47:14 +01:00
Alex Orlenko ed796fff51 Support async require loaders for Luau 2025-05-04 11:00:59 +01:00
Alex Orlenko f0c0527c2b Update Lua* dependencies 2025-05-03 17:58:33 +01:00
Alex Orlenko 64b1d152b9 Deprecate Lua::load_from_finction and replace it with Lua::register_module and Lua::preload_module instead. 2025-04-26 13:42:07 +01:00
Alex Orlenko 9fda2ecfcc mlua-sys: Update Luau to 0.671 2025-04-25 23:38:49 +01:00
Alex Orlenko 560a30ca02 Support new Luau require system
This commit introduces the `Require` trait that be used to change `require` behaviour.
By default mlua implements behaviour same as `ReplRequirer` in the original Luau.
Unfortunately binary Luau modules are no longer supported by the new system.
2025-04-25 14:19:41 +01:00
Alex Orlenko 117f8377e2 mlua-sys: Add definitions for Luau require library (since 0.669) 2025-04-20 21:44:16 +02:00
Alex Orlenko 12e61e01f6 Restrict access to Luau VM from UserData destructors.
It's unsafe to make almost any Lua calls when userdata destructor is running.
This can cause recursive GC run and crash.
See https://github.com/luau-lang/luau/pull/510 for some details.
2025-04-05 10:31:39 +01:00
Alex Orlenko 53ff494ab9 Prepare for custom (Luau) userdata destructors.
We need to add logic later to prevent calling any Lua functions when UserData destructor is running.
2025-04-04 16:36:06 +01:00
Alex Orlenko 72682198eb Bump Luau to 0.667 2025-03-30 11:12:14 +01:00
Alex Orlenko 95c623e94d Use c string literal where appropriate 2025-03-21 15:57:15 +00:00
Alex Orlenko edbf1e9150 Change Lua library name constants from &str to *const c_char.
It makes easier to pass them to Lua API functions.
2025-03-14 23:10:14 +00:00
Alex Orlenko 69011a89d2 Revert "Add initial pluto support"
This reverts commit 0ed11e4134.
2025-03-14 22:59:06 +00:00
Alex Orlenko 0ed11e4134 Add initial pluto support
Pluto is a superset of Lua 5.4 with a focus on general-purpose programming.
`pluto` feature also enables `lua54` feature since they are compatible and share the same API.
2025-03-14 11:38:07 +00:00
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
Alex Orlenko e706ae4fcb Remove Roblox from references to Luau
Closes #537
2025-02-24 19:03:36 +00:00
Alex Orlenko cdd6a99136 Support Thread::resume_error call (Luau)
This method uses Luau-specific C API extension `lua_resumerror`
that allow to throw an error immediately when resuming a thead.
Closes #500 #513
2025-01-28 22:57:26 +00:00
Alex Orlenko aa3f6ba46c Fix prototype of new Luau compiler options and methods 2025-01-27 21:19:31 +00:00
Alex Orlenko cc57bed4c8 Update Luau to 0.657 2025-01-27 14:19:40 +00:00
Alex Orlenko 7a3f19b857 Ensure that buffer with Luau compiled code is always freed 2024-11-29 13:36:51 +00:00
Alex Orlenko b34d67ec41 Update Luau to 0.650 (luau0-src 0.11.1) 2024-11-03 14:49:12 +00:00
Alex Orlenko 81d7c81532 Update Luau to 0.647 2024-10-12 21:30:56 +01:00
Alex Orlenko 3088516851 Update luaL_checkstack messages 2024-09-22 17:33:28 +01:00
Alex Orlenko ecc09c4387 Add luaL_loadbufferenv helper to all Lua versions 2024-08-25 17:29:58 +01:00
bjcscat 7bfd32750d Change chunk env to use luau's load env parameter (#442) 2024-08-25 16:50:41 +01:00
Alex Orlenko b4892c228c Add rustfmt.toml 2024-07-31 13:42:37 +01:00
Alex Orlenko 884a025b52 Fix some clippy warnings 2024-06-18 16:09:08 +01:00
Alex Orlenko b46cad1db1 Support Luau v0.629 2024-06-09 00:37:58 +01:00
Alex Orlenko 317ce7caa6 Add Lua::set_fflag() to control Luau feature flags 2024-05-04 21:15:22 +01:00
Alex Orlenko 3a44729a48 Mark lua_Callbacks as non exhaustive (Luau) 2024-05-04 21:11:29 +01:00
Alex Orlenko 3d46fad459 Update luau-src to v0.9
Mark `lua_CompileOptions` as non exhaustive
2024-05-04 21:10:24 +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 5a22437d5f Assert that luau_compile returns non-null pointer.
Fixes #381
2024-03-16 23:39:10 +00:00
Alex Orlenko e30b425224 Fix crash when initializing Luau sandbox without stdlibs (#361) 2024-01-27 11:51:59 +00:00
Alex Orlenko e97e69a309 Update Luau to 0.609 (luau-src v0.8.0) 2024-01-25 09:38:46 +00:00
Alex Orlenko 3c801e7b17 Expose internal POLL_PENDING constant (hidden) 2024-01-20 15:52:00 +00:00
Alex Orlenko a38e484fe9 Increase luau max stack size to 1M from 100k 2024-01-18 23:05:23 +00:00
Alex Orlenko 514ec24252 Fix lua53/lua54 luaL_error definition (for wasm32) 2024-01-03 12:02:53 +00:00
Alex Orlenko c0a0983025 mlua-sys: always inline lua_error 2024-01-03 11:31:39 +00:00
Alex Orlenko 69ff0c5509 mlua-sys: fix Lua 5.2 lua_sethook definition 2024-01-03 10:22:42 +00:00
Aymen-Hakim bf79d6c212 Update lauxlib.rs (#351)
lua54 in lua53 src.
2023-12-27 15:07:59 -05:00
ByteDream 0b9a85e183 Add lua emscripten support (#338) 2023-12-14 14:54:57 +00:00
Alex Orlenko 59974d7bde Merge pull request #337 from tari/emscripten-support
Fix build for emscripten target
2023-12-13 13:55:26 +00:00
eatradish 4c92580201 Add loongarch64 architecture support 2023-12-08 11:16:52 +08:00
Peter Marheine e3f34f319c Correct C return type for lua_error
The definition of lua_error in all of Lua 5.1 through 5.4 says lua_error
returns int, but the Rust definition of the same function treats it as
void (because it's known not to return). This causes link-time errors when
building for wasm targets because the wasm linker is aware of function return
types and errors out if they differ between definition and declaration.
2023-12-06 21:16:52 +11:00
Peter Marheine b16f3895a0 lua54: use changed return type for lua_rawlen
Lua 5.4 changed lua_rawlen to return lua_Unsigned, versus size_t in earlier
versions. Change the C API signature to match, and add a wrapper function with
the same name that maintains a stable Rust API by casting to usize.
2023-12-06 21:09:25 +11: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 b879abc418 Add lua_newuserdata_t helper to mlua-sys/luau 2023-10-24 23:58:47 +01:00
Alex Orlenko a1e39a8620 Remove MemoryState from ExtraData and retrieve using lua_getallocf (recently added to Luau) 2023-10-24 00:23:32 +01:00