From 9a11cd62ac1ca5659a36fb3111d3bf7dead9d85b Mon Sep 17 00:00:00 2001 From: Tim Keller Date: Sun, 3 Nov 2024 15:26:51 -0600 Subject: use gears.table.clone instead of table.move --- widgets/cpu.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'widgets') 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() -- cgit v1.2.3