I couldn't help but notice we didn't have a FizzBuzz in lua yet. I've always wanted to take a shot at Lua, so here goes nothing.
function fizzBuzz(maxNum) local fizz = "Lua" local buzz = "Yay" for i = 1, maxNum do if i % 15 == 0 then print(fizz..buzz) elseif i % 3 == 0 then print(fizz) elseif i % 5 == 0 then print (buzz) else print(i) end end end fizzBuzz(100)
1 2 Lua 4 Yay Lua 7 8 Lua Yay 11 Lua 13 14 LuaYay 16 17
I highly doubt it's idiomatic Lua, so I'm open for suggestions. As far as I know mixedCase and 2-space indentation are the way to go for Lua, but feel free to prove me wrong.