add get_system_info function

This commit is contained in:
Evgeny
2021-09-01 10:06:43 +03:00
parent a1b6f73221
commit 260ec67225
4 changed files with 43 additions and 8 deletions

View File

@@ -1,9 +1,10 @@
-- name = "Battery info"
ticks = 0
ticks = -1
function on_tick()
-- Update one time per 10 seconds
ticks = ticks + 1
if ticks % 10 ~= 0 then
return
end
@@ -19,12 +20,12 @@ function stringify_table(tab)
local new_tab = {}
for k,v in pairs(tab) do
table.insert(new_tab, k:capitalize()..": "..tostring(v))
table.insert(new_tab, capitalize(k)..": "..tostring(v))
end
return new_tab
end
function string:capitalize()
return (self:gsub("^%l", string.upper))
function capitalize(string)
return string:gsub("^%l", string.upper)
end