Advertisement
KodingKid

Lua input - all you need to know!

Apr 29th, 2021
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.88 KB | None | 0 0
  1. user_name = io.read("*l") --makes an input variable for a username
  2. display_name = io.read("*l") --makes an input variable for a display name
  3. bio = io.read("*l") --makes an input variable for a bio/description
  4. player = user_name + display_name + bio --adds all of them together in a single variable
  5. print(player) --the single variable is printed
  6. --other forms of input:
  7. number = io.read("*n") -- a number assigned a variable
  8. variable1 = io.read("*l") -- default input
  9. a = io.read("*a") -- total stdin
  10. x = io.read(7) -- 7 characters assigned a variable
  11. x,y = io.read(7,15) -- 7 to 15 characters assigned two variables
  12. a,b = io.read("*n","*n") --two numbers assigned two variables
  13. io.write('Hello, what is your name? ') -- question
  14. local name = io.read() --variable input
  15. io.write('Nice to meet you, ', name, '!\n') --prints input
  16. --for more lua, see here: https://pastebin.com/FKbinHk1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement