2022-07-14 22:33:22 -04:00
|
|
|
local pure = require 'pure'
|
2017-07-19 00:36:15 -04:00
|
|
|
|
2022-07-17 18:40:24 -04:00
|
|
|
return function(main_state, common, width, point)
|
2021-07-18 00:06:49 -04:00
|
|
|
local TEXT_SPACING = 20
|
|
|
|
|
|
|
|
local __string_match = string.match
|
|
|
|
local __string_gmatch = string.gmatch
|
|
|
|
|
2022-07-14 22:33:22 -04:00
|
|
|
local mk_stats = function(y)
|
|
|
|
local obj = common.make_text_rows(
|
|
|
|
point.x,
|
|
|
|
y,
|
2022-07-17 12:40:36 -04:00
|
|
|
width,
|
2022-07-14 22:33:22 -04:00
|
|
|
TEXT_SPACING,
|
|
|
|
{'Total', 'Explicit', 'Outdated', 'Orphaned', 'Local'}
|
|
|
|
)
|
2022-07-16 00:27:27 -04:00
|
|
|
local update = function()
|
2022-07-16 00:00:06 -04:00
|
|
|
local stats = __string_match(
|
2022-07-16 00:27:27 -04:00
|
|
|
main_state.pacman_stats,
|
2022-07-16 00:00:06 -04:00
|
|
|
'%d+%s+[^%s]+%s+[^%s]+%s+(.*)$'
|
|
|
|
)
|
2022-07-14 22:33:22 -04:00
|
|
|
if stats then
|
|
|
|
local i = 1
|
|
|
|
for v in __string_gmatch(stats, '%d+') do
|
|
|
|
common.text_rows_set(obj, i, v)
|
|
|
|
i = i + 1
|
|
|
|
end
|
|
|
|
else
|
|
|
|
for i = 1, 5 do
|
|
|
|
common.text_rows_set(obj, i, 'N/A')
|
|
|
|
end
|
2021-07-18 00:06:49 -04:00
|
|
|
end
|
2019-10-10 22:52:49 -04:00
|
|
|
end
|
2022-07-17 18:54:23 -04:00
|
|
|
return common.mk_acc(
|
2022-07-17 12:40:36 -04:00
|
|
|
width,
|
2022-07-14 22:33:22 -04:00
|
|
|
TEXT_SPACING * 4,
|
|
|
|
update,
|
|
|
|
pure.partial(common.text_rows_draw_static, obj),
|
|
|
|
pure.partial(common.text_rows_draw_dynamic, obj)
|
|
|
|
)
|
2019-10-10 22:52:49 -04:00
|
|
|
end
|
2017-07-19 00:36:15 -04:00
|
|
|
|
2022-07-17 18:54:23 -04:00
|
|
|
return common.compile_module(
|
2022-07-14 22:49:08 -04:00
|
|
|
'PACMAN',
|
|
|
|
point,
|
2022-07-17 12:40:36 -04:00
|
|
|
width,
|
2022-07-16 23:48:01 -04:00
|
|
|
{{mk_stats, true, 0}}
|
2022-07-14 22:33:22 -04:00
|
|
|
)
|
2021-07-17 00:17:22 -04:00
|
|
|
end
|