From 93f0b2a5de5ca80cc161ae08a2eca97af3ef3e65 Mon Sep 17 00:00:00 2001 From: Alex Orlenko Date: Fri, 27 May 2022 12:26:56 +0100 Subject: [PATCH] Update type of lua_Integer for lua51/52 --- src/ffi/lua51/lua.rs | 5 ++++- src/ffi/lua52/lua.rs | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/ffi/lua51/lua.rs b/src/ffi/lua51/lua.rs index 3ad2db5..6c99503 100644 --- a/src/ffi/lua51/lua.rs +++ b/src/ffi/lua51/lua.rs @@ -67,7 +67,10 @@ pub const LUA_MINSTACK: c_int = 20; pub type lua_Number = c_double; /// A Lua integer, usually equivalent to `i64` -pub type lua_Integer = isize; +#[cfg(target_pointer_width = "32")] +pub type lua_Integer = i32; +#[cfg(target_pointer_width = "64")] +pub type lua_Integer = i64; /// Type for native C functions that can be passed to Lua. pub type lua_CFunction = unsafe extern "C" fn(L: *mut lua_State) -> c_int; diff --git a/src/ffi/lua52/lua.rs b/src/ffi/lua52/lua.rs index 44097da..f8c7108 100644 --- a/src/ffi/lua52/lua.rs +++ b/src/ffi/lua52/lua.rs @@ -69,7 +69,10 @@ pub const LUA_RIDX_LAST: lua_Integer = LUA_RIDX_GLOBALS; pub type lua_Number = c_double; /// A Lua integer, usually equivalent to `i64` -pub type lua_Integer = isize; +#[cfg(target_pointer_width = "32")] +pub type lua_Integer = i32; +#[cfg(target_pointer_width = "64")] +pub type lua_Integer = i64; /// A Lua unsigned integer, equivalent to `u32` in Lua 5.2 pub type lua_Unsigned = c_uint;