diff options
author | Tim Keller <tjkeller.xyz> | 2024-11-03 15:26:51 -0600 |
---|---|---|
committer | Tim Keller <tjkeller.xyz> | 2024-11-03 15:26:51 -0600 |
commit | 9a11cd62ac1ca5659a36fb3111d3bf7dead9d85b (patch) | |
tree | 635365dcbbf089fa4c9b24d257ebd211b5ccaa57 /widgets | |
parent | cc68c3adcde665ca63ae0873e4dfca8c94a7c9e0 (diff) | |
download | awesome-9a11cd62ac1ca5659a36fb3111d3bf7dead9d85b.tar.xz awesome-9a11cd62ac1ca5659a36fb3111d3bf7dead9d85b.zip |
use gears.table.clone instead of table.move
Diffstat (limited to 'widgets')
-rw-r--r-- | widgets/cpu.lua | 5 |
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() |