Модуль:Песочница/CatBG: различия между версиями

Новая страница: «local p = {} -- Парсим строки вида "10h", "2.5h" → секунды local function parse_hours_string(s) if type(s) ~= "string" then return nil end local h = s:match("^%s*([%d.]+)%s*[hH]%s*$") if h then local num = tonumber(h) if num then return num * 3600 end end return nil end local function format_time(mode, value) local total_seconds -- Попытка распарсить...»
 
Нет описания правки
Строка 52: Строка 52:
     local args = frame.args
     local args = frame.args
     local mode = args[1] or "seconds"
     local mode = args[1] or "seconds"
     local value = args[2] or 0
     local value = tonumber(args[2]) or 0


     return format_time(mode, value)
     return format_time(mode, value)