From 6e95386f30f2c7d20ae1158b907cd0ab8b9a1924 Mon Sep 17 00:00:00 2001 From: Alex Orlenko Date: Sat, 3 Dec 2022 17:55:26 +0000 Subject: [PATCH] Update Luau to 0.555 (luau-src 0.5.0) This version includes inreased LUAI_MAXCSTACK limit (100000) --- Cargo.toml | 2 +- src/ffi/luau/lua.rs | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index b048f7f..c228275 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -58,7 +58,7 @@ cc = { version = "1.0" } pkg-config = { version = "0.3.17" } lua-src = { version = ">= 544.0.0, < 550.0.0", optional = true } luajit-src = { version = ">= 210.4.0, < 220.0.0", optional = true } -luau0-src = { version = "0.4.0", optional = true } +luau0-src = { version = "0.5.0", optional = true } [dev-dependencies] rustyline = "10.0" diff --git a/src/ffi/luau/lua.rs b/src/ffi/luau/lua.rs index 624e427..22391ef 100644 --- a/src/ffi/luau/lua.rs +++ b/src/ffi/luau/lua.rs @@ -7,12 +7,15 @@ use std::ptr; // Option for multiple returns in 'lua_pcall' and 'lua_call' pub const LUA_MULTRET: c_int = -1; +// Max number of Lua stack slots +const LUAI_MAXCSTACK: c_int = 100000; + // // Pseudo-indices // -pub const LUA_REGISTRYINDEX: c_int = -10000; -pub const LUA_ENVIRONINDEX: c_int = -10001; -pub const LUA_GLOBALSINDEX: c_int = -10002; +pub const LUA_REGISTRYINDEX: c_int = -LUAI_MAXCSTACK - 2000; +pub const LUA_ENVIRONINDEX: c_int = -LUAI_MAXCSTACK - 2001; +pub const LUA_GLOBALSINDEX: c_int = -LUAI_MAXCSTACK - 2002; pub const fn lua_upvalueindex(i: c_int) -> c_int { LUA_GLOBALSINDEX - i