# HG changeset patch # User Kim Alvefur # Date 1690020481 -7200 # Node ID 59c3d775c7fa1174e8a233a1a7c81f662c510445 # Parent 9c72f93b7a02290d01352d30624ec554bf2c7aa7 core.moduleapi: Parse period min/max arguments Allows specifying them the same way as the default and in the config, for consistency diff -r 9c72f93b7a02 -r 59c3d775c7fa core/moduleapi.lua --- a/core/moduleapi.lua Fri Jul 21 18:30:06 2023 +0200 +++ b/core/moduleapi.lua Sat Jul 22 12:08:01 2023 +0200 @@ -295,10 +295,16 @@ return math.huge; end + if type(min) == "string" then + min = human_io.parse_duration(min); + end if min and ret < min then self:log("warn", "Config option '%s' out of bounds %g < %g", name, ret, min); return min; end + if type(max) == "string" then + max = human_io.parse_duration(max); + end if max and ret > max then self:log("warn", "Config option '%s' out of bounds %g > %g", name, ret, max); return max;