-
---[[This may be moved to a separate library at some point]]
-local utils =
-{
- ---
- -- Asks the user for Yes or No
- confirm = function(message, ...)
- local answer
- message = message .. " [y]/[n] ?"
- repeat
- io.write(message)
- io.flush()
- answer=io.read()
- if answer == 'Y' or answer == "y" then
- return true
- elseif answer == 'N' or answer == 'n' then
- return false
- end
- until false
- end,
- ---
- -- Asks the user for input
- input = function (message , default)
- local answer
- if default ~= nil then
- message = message .. " (default: ".. default.. " )"
- end
- message = message .." \n > "
- io.write(message)
- io.flush()
- answer=io.read()
- if answer == '' then answer = default end
-
- return answer
- end,
-}