Fixed LUA_REGISTRYINDEX when generating `glue.rs` on cross-compiling for lua51(jit)

This commit is contained in:
Alex Orlenko 2021-10-08 20:57:19 +01:00
parent 259eb09ae1
commit 458b06796c
No known key found for this signature in database
GPG Key ID: 4C150C250863B96D
1 changed files with 8 additions and 6 deletions

View File

@ -143,16 +143,18 @@ fn generate_glue() -> Result<()> {
(version.0 * 100) + version.1
)?;
let max_stack = if pointer_bit_width >= 32 {
1_000_000
} else {
15_000
};
#[cfg(any(feature = "lua54", feature = "lua53", feature = "lua52"))]
writeln!(
glue,
"pub const LUA_REGISTRYINDEX: c_int = -{} - 1000;",
max_stack
if pointer_bit_width >= 32 {
1_000_000
} else {
15_000
}
)?;
#[cfg(any(feature = "lua51", feature = "luajit"))]
writeln!(glue, "pub const LUA_REGISTRYINDEX: c_int = -10000;")?;
// These two are only defined in lua 5.1
writeln!(glue, "pub const LUA_ENVIRONINDEX: c_int = -10001;")?;