local video, cpu, other = 0 local videotemp, cputemp, other1temp, other2temp = "" local i = 1 for s in io.popen("sensors"):lines() do srch(s); i = i + 1; end print("CPU: " .. cputemp .. "\n" .. "GPU: ".. videotemp) local function srch(x) if (string.len(x) < 6) then return 1; end if (string.find(x, "radeon-pci-", 1, true) ~= nil) then video = 1; return 1; end if (video == 1) then if (string.find(x, "temp1:", 1, true) ~= nil) then videotemp = string.sub(x, 15, 22); video = 0; return 1; end end if (string.find(x, "k10temp-pci-", 1, true) ~= nil) then cpu = 1; return 1; end if (cpu == 1) then if (string.find(x, "temp1:", 1, true) ~= nil) then cputemp = string.sub(x, 15, 22); cpu = 0; return 1; end end end |