26 lines
518 B
Lua
26 lines
518 B
Lua
-- Assistance from a friend
|
|
|
|
-- Instantiate all the things
|
|
local run = true
|
|
local cmd, number, randnum
|
|
|
|
-- Start a loop
|
|
while run == true do
|
|
-- Get the users initial number
|
|
print("Pick a number: ")
|
|
number = io.read("*n")
|
|
|
|
-- Do some mathemagic
|
|
randnum = math.random(1, number)
|
|
print("The number is ", randnum)
|
|
|
|
-- Ask to rerun script
|
|
io.read()
|
|
print("Run again (Y/n)?")
|
|
cmd = io.read("*l")
|
|
|
|
-- Exit if the user doesn't want to go again
|
|
if string.lower(cmd) ~= "y" then
|
|
run = false
|
|
end
|
|
end |