summaryrefslogtreecommitdiff
path: root/lua/helpers.lua
diff options
context:
space:
mode:
authorLNJ <git@lnj.li>2017-04-01 22:30:07 +0200
committerLNJ <git@lnj.li>2017-04-01 22:30:07 +0200
commit0acdd1a48a4a41f27fde7313951660396e54e39b (patch)
treeae8d4f4eb3bbab34fceb334bd48bb6145070e012 /lua/helpers.lua
parent038a1aef7476b72a88ece9ef3a890790f9f5c4d4 (diff)
Fix infotext is displaying "0 Empty (0% full)"v0.2.1
Diffstat (limited to 'lua/helpers.lua')
-rwxr-xr-xlua/helpers.lua7
1 files changed, 6 insertions, 1 deletions
diff --git a/lua/helpers.lua b/lua/helpers.lua
index 173a472..3718da3 100755
--- a/lua/helpers.lua
+++ b/lua/helpers.lua
@@ -31,7 +31,12 @@ function drawers.gen_info_text(basename, count, factor, stack_max)
-- round the number (float -> int)
percent = math.floor(percent + 0.5)
- return tostring(count) .. " " .. basename .. " (" .. tostring(percent) .. "% full)"
+ if count == 0 then
+ return basename .. " (" .. tostring(percent) .. "% full)"
+ else
+ return tostring(count) .. " " .. basename .. " (" ..
+ tostring(percent) .. "% full)"
+ end
end
function drawers.get_inv_image(name)