Skip to content

Commit

Permalink
one more fix for Lua 5.3
Browse files Browse the repository at this point in the history
Apply double->integer to value only not to string like "xx KB"

See https://travis-ci.org/starius/lua-filesize/jobs/103981886
  • Loading branch information
starius committed Jan 21, 2016
1 parent 1c0d229 commit ae76414
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/filesize/filesize.lua
Expand Up @@ -127,9 +127,10 @@ local function filesize(size, options)
suffix = result[2],
}
elseif o.output == "string" then
local text = table.concat(result, o.spacer)
text = text:gsub('%.0 ', ' ') -- Lua 5.3
return text
local value = tostring(result[1])
value = value:gsub('%.0$', '')
local suffix = result[2]
return value .. o.spacer .. suffix
end
end

Expand Down

0 comments on commit ae76414

Please sign in to comment.