Skip to content

Commit 458b067

Browse files
committed
Fixed LUA_REGISTRYINDEX when generating glue.rs on cross-compiling for lua51(jit)
1 parent 259eb09 commit 458b067

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

build/main.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -143,16 +143,18 @@ fn generate_glue() -> Result<()> {
143143
(version.0 * 100) + version.1
144144
)?;
145145

146-
let max_stack = if pointer_bit_width >= 32 {
147-
1_000_000
148-
} else {
149-
15_000
150-
};
146+
#[cfg(any(feature = "lua54", feature = "lua53", feature = "lua52"))]
151147
writeln!(
152148
glue,
153149
"pub const LUA_REGISTRYINDEX: c_int = -{} - 1000;",
154-
max_stack
150+
if pointer_bit_width >= 32 {
151+
1_000_000
152+
} else {
153+
15_000
154+
}
155155
)?;
156+
#[cfg(any(feature = "lua51", feature = "luajit"))]
157+
writeln!(glue, "pub const LUA_REGISTRYINDEX: c_int = -10000;")?;
156158

157159
// These two are only defined in lua 5.1
158160
writeln!(glue, "pub const LUA_ENVIRONINDEX: c_int = -10001;")?;

0 commit comments

Comments
 (0)