Skip to content

Commit 873373f

Browse files
committed
Shorten text returned by CustomChat.NiceTime
1 parent d3b0803 commit 873373f

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

lua/custom_chat/client/main.lua

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -46,27 +46,23 @@ function CustomChat.NiceTime( time )
4646
local d = time % 7
4747
local w = Floor( time / 7 )
4848

49-
local parts = {}
50-
5149
if w > 0 then
52-
parts[#parts + 1] = w .. " " .. L( "time.weeks" )
50+
return w .. " " .. L( "time.weeks" )
5351
end
5452

5553
if d > 0 then
56-
parts[#parts + 1] = d .. " " .. L( "time.days" )
54+
return d .. " " .. L( "time.days" )
5755
end
5856

5957
if h > 0 then
60-
parts[#parts + 1] = Format( "%02i ", h ) .. L( "time.hours" )
58+
return Format( "%02i ", h ) .. L( "time.hours" )
6159
end
6260

63-
if m > 0 then
64-
parts[#parts + 1] = Format( "%02i ", m ) .. L( "time.minutes" )
61+
if m > 0 and h < 1 and d < 1 then
62+
return Format( "%02i ", m ) .. L( "time.minutes" )
6563
end
6664

67-
parts[#parts + 1] = Format( "%02i ", s ) .. L( "time.seconds" )
68-
69-
return table.concat( parts, " " )
65+
return Format( "%02i ", s ) .. L( "time.seconds" )
7066
end
7167

7268
function CustomChat.PrintMessage( text )

0 commit comments

Comments
 (0)