# HG changeset patch # User Kim Alvefur # Date 1754490881 -7200 # Node ID c9cc84bee17bf38cf6971358373db09d8b4a7d45 # Parent a88566e73a15b5f110ae45e209a86b0069a9ea8b util.gc: Handle Lua 5.5 way of passing parameters diff -r a88566e73a15 -r c9cc84bee17b util/gc.lua --- a/util/gc.lua Wed Aug 06 16:08:19 2025 +0200 +++ b/util/gc.lua Wed Aug 06 16:34:41 2025 +0200 @@ -5,7 +5,9 @@ generational = set.new { "mode", "minor_threshold", "major_threshold" }; }; -if _VERSION ~= "Lua 5.4" then +if _VERSION == "Lua 5.5" then + known_options.generational = set.new { "mode", "minor_multiplier", "minor_major_threshold", "major_minor_threshold" }; +elseif _VERSION ~= "Lua 5.4" then known_options.generational = nil; known_options.incremental:remove("step_size"); end @@ -31,15 +33,27 @@ user.speed or defaults.speed, user.step_size or defaults.step_size ); + elseif _VERSION == "Lua 5.5" then + collectgarbage(mode); + collectgarbage("param", "pause", user.threshold or defaults.threshold); + collectgarbage("param", "stepmul", user.speed or defaults.speed); + collectgarbage("param", "stepsize", user.step_size or defaults.step_size); else collectgarbage("setpause", user.threshold or defaults.threshold); collectgarbage("setstepmul", user.speed or defaults.speed); end elseif mode == "generational" then - collectgarbage(mode, - user.minor_threshold or defaults.minor_threshold, - user.major_threshold or defaults.major_threshold - ); + if _VERSION == "Lua 5.4" then + collectgarbage(mode, + user.minor_threshold or defaults.minor_threshold, + user.major_threshold or defaults.major_threshold + ); + elseif _VERSION == "Lua 5.5" then + collectgarbage(mode); + collectgarbage("param", "minormul", user.minor_multiplier or defaults.minor_multiplier); + collectgarbage("param", "majorminor", user.major_minor_threshold or defaults.major_minor_threshold); + collectgarbage("param", "minormajor", user.minor_major_threshold or defaults.minor_major_threshold); + end end return true; end