Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
18
Task/Menu/Lua/menu.lua
Normal file
18
Task/Menu/Lua/menu.lua
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
function select (list)
|
||||
if not list or #list == 0 then
|
||||
return ""
|
||||
end
|
||||
local last, sel = #list
|
||||
repeat
|
||||
for i,option in ipairs(list) do
|
||||
io.write(i, ". ", option, "\n")
|
||||
end
|
||||
io.write("Choose an item (1-", tostring(last), "): ")
|
||||
sel = tonumber(string.match(io.read("*l"), "^%d+$"))
|
||||
until type(sel) == "number" and sel >= 1 and sel <= last
|
||||
return list[math.floor(sel)]
|
||||
end
|
||||
|
||||
print("Nothing:", select {})
|
||||
print()
|
||||
print("You chose:", select {"fee fie", "huff and puff", "mirror mirror", "tick tock"})
|
||||
Loading…
Add table
Add a link
Reference in a new issue