diff --git a/lua/Notes/help1.png b/lua/Notes/help1.png new file mode 100644 index 0000000..83c236f Binary files /dev/null and b/lua/Notes/help1.png differ diff --git a/lua/placeholder.lua b/lua/placeholder.lua deleted file mode 100644 index e69de29..0000000 diff --git a/lua/randTest.lua b/lua/randTest.lua new file mode 100644 index 0000000..123ab6f --- /dev/null +++ b/lua/randTest.lua @@ -0,0 +1,10 @@ +io.write("Pick a number: ") +local number = io.read("*n") +local randnum = math.random(1, number) +print("The number is ", randnum) +-- ask to rerun script +print("Run again (y/n)?") +local cmd = io.read() +if cmd == "y" then + dofile("randTest.lua") +else end \ No newline at end of file diff --git a/lua/randTestHelped.lua b/lua/randTestHelped.lua new file mode 100644 index 0000000..c338d7e --- /dev/null +++ b/lua/randTestHelped.lua @@ -0,0 +1,26 @@ +-- 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 \ No newline at end of file