Are there plans to add Lua tutorials? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Are there plans to add Lua tutorials?

So I've been tinkering with lua to learn to use an engine I want to use to build games with. I made demo coin toss game to test out the language. I wanted to throw it up here to see y'all's thoughts... --[[ for some reason lua can't randomise unless seeded and then randomised 1 time PRIOR to the variable you define]] math.randomseed(os.time()) math.random() repeat --user inputs chosen face io.write ("heads or tails: ") guess = io.read() if (guess == "heads") then guess = 1 elseif (guess == "tails") then guess = 2 else io.write ("That is not a valid input ", "\n") end --[[careful with spelling SciTE can't undo on the cmd what's already been typed as it sends input to cmd as you type it]] --setting coin variable coin = math.random(2) if (coin == 1) then io.write ("heads", "\n") else io.write ("tails", "\n") end tonumber(guess) until guess == coin

12th Jun 2019, 9:14 AM
RevanChan
RevanChan - avatar
0 Answers