FS#13898 expand date_time.lua example
rockbox-gerrit-noreply--- via rockbox-cvs <[email protected]> Sat, 16 May 2026 15:54:42 -0400
| Newsgroups | gmane.comp.systems.archos.rockbox.cvs |
|---|---|
| Message-ID | <[email protected]> |
commit 7c2e84ad2f47f6697a9238169b274940e09a7833 Author: William Wilgus <[email protected]> Date: Sat May 16 15:51:07 2026 -0400 FS#13898 expand date_time.lua example os.date(*t) did not return table when *t supplied because require("strfrtime.lua") was not loaded Change-Id: I89b02adad633dca0106b571bdb4b10ffb39cbcf6 diff --git a/apps/plugins/lua_scripts/time_date.lua b/apps/plugins/lua_scripts/time_date.lua index bf7f7bd5ec..63a3e611d1 100644 --- a/apps/plugins/lua_scripts/time_date.lua +++ b/apps/plugins/lua_scripts/time_date.lua @@ -35,14 +35,24 @@ local used, allocd, free = rb.mem_stats() local lu = collectgarbage("count") local fmt = function(t, v) return string.format("%s: %d b\n", t, v) end +time = os.date("*t") + +time_string = "" + +for key, value in pairs(time) do + time_string = time_string .. key .. ": " .. tostring(value) .. "\n" +end + -- this is how lua recommends to concat strings rather than .. local s_t = {} s_t[1] = os.date() s_t[2] = "\n" -s_t[3] = fmt("Used ", used) -s_t[4] = fmt("Allocd ", allocd) -s_t[5] = fmt("Free ", free) -s_t[6] = "\nlua:\n" -s_t[7] = fmt("Used", lu * 1024) -s_t[8] = "\n\nNote that the rockbox used count is a high watermark\n" +s_t[3] = time_string +s_t[4] = "\n" +s_t[5] = fmt("Used ", used) +s_t[6] = fmt("Allocd ", allocd) +s_t[7] = fmt("Free ", free) +s_t[8] = "\nlua:\n" +s_t[9] = fmt("Used", lu * 1024) +s_t[10] = "\n\nNote that the rockbox used count is a high watermark\n" rb.splash_scroller(10 * rb.HZ, table.concat(s_t)) -- rockbox-cvs mailing list [email protected] https://lists.haxx.se/mailman/listinfo/rockbox-cvs