feat: add puzzle selection and execution menu

This commit is contained in:
2025-11-28 16:42:55 +01:00
parent 75a2b404b1
commit fcf9820f9a
3 changed files with 98 additions and 11 deletions

View File

@@ -22,7 +22,37 @@ function utils.promptChoices(choices)
break
end
end
term.setTextColor(colors.white)
return choices[c]
end
function utils.readFile(path)
if not fs.exists(path) then
printError("File " .. path .. " not found")
return nil
end
local file = fs.open(path, "r")
if not file then
printError("Could not open file")
return nil
end
local data = file.readAll()
file.close()
return data
end
function utils.waitForKey(targetKey)
if targetKey then
print("Press " .. keys.getName(targetKey):upper() .. " to continue")
else
print("Press any key to continue")
end
while true do
local event, key, is_held = os.pullEvent("key")
if not targetKey or key == targetKey then
break
end
end
end
return utils