From e79cd9c029d0aa88327e62573602aa4748006641 Mon Sep 17 00:00:00 2001 From: Luke Bonham Date: Tue, 19 May 2015 15:41:33 +0200 Subject: [PATCH 1/1] net: removed 'tostring' for numbers --- widgets/mem.lua | 4 +--- widgets/net.lua | 5 ++--- widgets/sysload.lua | 3 +-- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/widgets/mem.lua b/widgets/mem.lua index 986fa76..46bb5f9 100644 --- a/widgets/mem.lua +++ b/widgets/mem.lua @@ -13,9 +13,7 @@ local wibox = require("wibox") local io = { lines = io.lines } local math = { floor = math.floor } -local string = { format = string.format, - gmatch = string.gmatch, - len = string.len } +local string = { gmatch = string.gmatch } local setmetatable = setmetatable diff --git a/widgets/net.lua b/widgets/net.lua index 2b06622..2585ad4 100644 --- a/widgets/net.lua +++ b/widgets/net.lua @@ -14,7 +14,6 @@ local naughty = require("naughty") local wibox = require("wibox") local io = { popen = io.popen } -local tostring = tostring local string = { format = string.format, gsub = string.gsub, match = string.match } @@ -71,10 +70,10 @@ local function worker(args) local now_r = helpers.first_line('/sys/class/net/' .. iface .. '/statistics/rx_bytes') or 0 - net_now.sent = tostring((now_t - net.last_t) / timeout / units) + net_now.sent = (now_t - net.last_t) / timeout / units net_now.sent = string.gsub(string.format('%.1f', net_now.sent), ",", ".") - net_now.received = tostring((now_r - net.last_r) / timeout / units) + net_now.received = (now_r - net.last_r) / timeout / units net_now.received = string.gsub(string.format('%.1f', net_now.received), ",", ".") widget = net.widget diff --git a/widgets/sysload.lua b/widgets/sysload.lua index b15b1bf..144ad0c 100644 --- a/widgets/sysload.lua +++ b/widgets/sysload.lua @@ -12,8 +12,7 @@ local newtimer = require("lain.helpers").newtimer local wibox = require("wibox") local io = { open = io.open } -local string = { format = string.format, - match = string.match } +local string = { match = string.match } local setmetatable = setmetatable -- 2.39.5