Advertisement
DOGGYWOOF

Confirm

Jan 1st, 2024
10
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. function confirmationPrompt()
  2. print("Do you want to continue? (y/n)")
  3. local input = read()
  4.  
  5. if input == "y" then
  6. -- Your code for continuing goes here
  7. print("Continuing...")
  8. elseif input == "n" then
  9. print("Operation canceled.")
  10. else
  11. print("Invalid input. Please enter 'y' to continue or 'n' to cancel.")
  12. confirmationPrompt() -- Ask for input again
  13. end
  14. end
  15.  
  16. confirmationPrompt() -- Call the function to start the prompt
  17.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement