From c6d941181473fce6b2325cb12794786297067fa9 Mon Sep 17 00:00:00 2001 From: Bryce Wilson Date: Sun, 16 Aug 2026 02:22:31 -0600 Subject: [PATCH] BizHawkClient: Fix compatibility for Lua 5.5+ (#6200) --- data/lua/base64.lua | 10 +++++----- data/lua/connector_bizhawk_generic.lua | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/data/lua/base64.lua b/data/lua/base64.lua index ebe80643531..2f02340df99 100644 --- a/data/lua/base64.lua +++ b/data/lua/base64.lua @@ -5,11 +5,7 @@ local base64 = {} local extract = _G.bit32 and _G.bit32.extract -- Lua 5.2/Lua 5.3 in compatibility mode if not extract then - if _G._VERSION == "Lua 5.4" then - extract = load[[return function( v, from, width ) - return ( v >> from ) & ((1 << width) - 1) - end]]() - elseif _G.bit then -- LuaJIT + if _G.bit then -- LuaJIT local shl, shr, band = _G.bit.lshift, _G.bit.rshift, _G.bit.band extract = function( v, from, width ) return band( shr( v, from ), shl( 1, width ) - 1 ) @@ -27,6 +23,10 @@ if not extract then end return w end + else -- Lua 5.3+ + extract = load[[return function( v, from, width ) + return ( v >> from ) & ((1 << width) - 1) + end]]() end end diff --git a/data/lua/connector_bizhawk_generic.lua b/data/lua/connector_bizhawk_generic.lua index 387ca2c6f3b..98507af45bd 100644 --- a/data/lua/connector_bizhawk_generic.lua +++ b/data/lua/connector_bizhawk_generic.lua @@ -633,8 +633,8 @@ end) if bizhawk_major < 2 or (bizhawk_major == 2 and bizhawk_minor < 7) then print("Must use BizHawk 2.7.0 or newer") else - if bizhawk_major > 2 or (bizhawk_major == 2 and bizhawk_minor > 10) then - print("Warning: This version of BizHawk is newer than this script. If it doesn't work, consider downgrading to 2.10.") + if bizhawk_major > 2 or (bizhawk_major == 2 and bizhawk_minor > 11) then + print("Warning: This version of BizHawk is newer than this script. If it doesn't work, consider downgrading to 2.11.") end if emu.getsystemid() == "NULL" then