Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local args = {...} --get the arguments from the command line and put them in the table named args
- if #args < 1 then --if we did not get any arguments, tell the user to provide them
- print("Usage: "..fs.getName(shell.getRunningProgram()).." <length>") --fancy stuff to print the name of the program.
- return --quit early, since we got no arguments.
- elseif tonumber(args[1]) == nil then --the user gave us an argument, but it was not a number! Print usage again.
- print("Usage: "..fs.getName(shell.getRunningProgram()).." <length>")
- return
- end
- --now, since the code made it here, we must have at least one argument that can be made into a number.
- local length = tonumber(args[1]) --take the first argument (that is the [1] part, the first index of the table), convert it to a number, and store the result in our length variable.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement