You've already forked ComfyFactorio
mirror of
https://github.com/ComfyFactory/ComfyFactorio.git
synced 2026-06-20 16:32:28 +02:00
More elegant solution for more use-cases
Filter_time will return input table if filtered table would have been empty, should fix bugs
This commit is contained in:
@@ -105,6 +105,9 @@ function Public.filter_time(fancy_array, filter_words, mode)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
if #filtered_array == 0 then
|
||||||
|
filtered_array = fancy_array
|
||||||
|
end
|
||||||
return filtered_array
|
return filtered_array
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -124,9 +127,7 @@ end
|
|||||||
---@param seconds <number>
|
---@param seconds <number>
|
||||||
function Public.short_fancy_time(seconds)
|
function Public.short_fancy_time(seconds)
|
||||||
local fancy = Public.seconds_to_fancy(seconds,true)
|
local fancy = Public.seconds_to_fancy(seconds,true)
|
||||||
if seconds > 59 then
|
fancy = Public.filter_time(fancy, {"seconds","s"}, false)
|
||||||
fancy = Public.filter_time(fancy, {"seconds","s"}, false)
|
|
||||||
end
|
|
||||||
fancy = Public.fancy_time_formatting(fancy)
|
fancy = Public.fancy_time_formatting(fancy)
|
||||||
return fancy
|
return fancy
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user