summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--widgets/cpu.lua5
1 files changed, 3 insertions, 2 deletions
diff --git a/widgets/cpu.lua b/widgets/cpu.lua
index d92bce8..b539e08 100644
--- a/widgets/cpu.lua
+++ b/widgets/cpu.lua
@@ -1,5 +1,6 @@
local wibox = require("wibox")
local widgets = require("util.widgets")
+local gears = require("gears")
-- this is directly adapted from slstatus's cpu.c module
local cpu_time = { 0,0,0,0,0,0,0 } -- user, nice, system, idle, iowait, irq, softirq
@@ -12,8 +13,8 @@ function linux_cpu_usage(widget)
-- calc
local sum = 0
- local a, b = cpu_time, {} -- set cpu_time as a for smaller code
- table.move(a, 1, 7, 1, b) -- copy first 7 to b
+ local a = cpu_time -- set cpu_time as a for smaller code
+ local b = gears.table.clone(a) -- copy a to b
for i = 1, 7 do
a[i] = stat_iter()