feat: add day menu

This commit is contained in:
2025-11-28 14:07:03 +01:00
parent 02c5542f2f
commit 75a2b404b1
4 changed files with 263 additions and 51 deletions

28
src/lib/utils.lua Normal file
View File

@@ -0,0 +1,28 @@
local utils = {}
function utils.promptChoices(choices)
local c = 1
local ox, oy = term.getCursorPos()
while true do
term.setCursorPos(ox, oy)
for i, choice in ipairs(choices) do
if i == c then
term.setTextColor(colors.white)
else
term.setTextColor(colors.lightGray)
end
print(choice)
end
local event, key, is_held = os.pullEvent("key")
if key == keys.up then
c = math.max(1, c - 1)
elseif key == keys.down then
c = math.min(#choices, c + 1)
elseif key == keys.enter then
break
end
end
return choices[c]
end
return utils