This is a simple Lua project that simulates a Magic Eight Ball. The user asks a yes-or-no question and the Magic Eight Ball responds with one of its pre-set answers. In this project, I am going to create a simple Magic Eight Ball using if/elseif/else statements and boolean expressions in the Lua programming langauge.
- Install Lua on your computer. You can download Lua from the official website: https://www.lua.org/download.html
- Clone or download the repository to your computer.
- Open a terminal or command prompt window and navigate to the directory where the files are located.
- Run the program by entering the following command:
lua magic_eight_ball.lua - The program will ask you to enter a yes-or-no question. Type your question and press Enter.
- The Magic Eight Ball will randomly choose one of its pre-set answers and display it on the screen.
- To exit the program, simply close the terminal or command prompt window.
- Click this link to the repl of this project: link
- The program will ask you to enter a yes-or-no question. Type your question and press Enter.
- The Magic Eight Ball will randomly choose one of its pre-set answers and display it on the screen.
If you want to customise the answers of the Magic Eight Ball, you can edit the answers table in the magic_eight_ball.lua file by cloning or downloading the repository. Simply add or remove answers from the table to change the possible responses of the Magic Eight Ball.
This project is licensed under the MIT License. See the LICENSE file for more information.
This project was inspired by the classic Magic Eight Ball toy! Thanks to Lua for providing a simple and flexible programming language!