BizHawkClient: Fix compatibility for Lua 5.5+ (#6200)

This commit is contained in:
Bryce Wilson
2026-08-16 10:22:31 +02:00
committed by GitHub
parent a0ca21b8d9
commit c6d9411814
2 changed files with 7 additions and 7 deletions
+5 -5
View File
@@ -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
+2 -2
View File
@@ -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