mirror of
https://github.com/sbrl/Minetest-WorldEditAdditions.git
synced 2024-11-22 15:33:00 +00:00
human_time: correctly handle non-number inputs
This commit is contained in:
parent
39a7168ac8
commit
a511d85e29
1 changed files with 1 additions and 0 deletions
|
@ -247,6 +247,7 @@ end
|
||||||
-- @param ms float The number of milliseconds to convert.
|
-- @param ms float The number of milliseconds to convert.
|
||||||
-- @return string A human-readable string representing the input ms.
|
-- @return string A human-readable string representing the input ms.
|
||||||
function worldeditadditions.human_time(ms)
|
function worldeditadditions.human_time(ms)
|
||||||
|
if type(ms) ~= "number" then return "unknown" end
|
||||||
local tokens = {
|
local tokens = {
|
||||||
{ 31536000 * 1000, 'year' },
|
{ 31536000 * 1000, 'year' },
|
||||||
{ 2592000 * 1000, 'month' },
|
{ 2592000 * 1000, 'month' },
|
||||||
|
|
Loading…
Reference in a new issue