mirror of
https://github.com/sbrl/Minetest-WorldEditAdditions.git
synced 2024-11-30 19:13:53 +01:00
human_time: correctly handle non-number inputs
This commit is contained in:
parent
39a7168ac8
commit
a511d85e29
@ -247,6 +247,7 @@ end
|
||||
-- @param ms float The number of milliseconds to convert.
|
||||
-- @return string A human-readable string representing the input ms.
|
||||
function worldeditadditions.human_time(ms)
|
||||
if type(ms) ~= "number" then return "unknown" end
|
||||
local tokens = {
|
||||
{ 31536000 * 1000, 'year' },
|
||||
{ 2592000 * 1000, 'month' },
|
||||
|
Loading…
Reference in New Issue
Block a user