Advertisement
Guest User

Luariffic

a guest
Aug 28th, 2015
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.88 KB | None | 0 0
  1. --So this is Lua's commenting stuff. I think that GLua, what Garry Newman uses for Garry's Mod allows // as a prefix.
  2.  
  3. function AddNumbers(number1, number2) --Simple, clean. I think you're allowed to specify returns, but it defaults to auto.
  4.  
  5. io.write("String concatination is".." so fucking easy.".." You can even do it with numbers: "..500);
  6.  
  7. local num = number1 + number2; --You don't need to specify any types ever.
  8. return num, num + 1; --Multiple return types; compacts it into an array before returning.
  9.  
  10. end --This is like pseudocode. Fucking love it.
  11.  
  12. --[[ Comment block syntax looks rad. ]]--
  13.  
  14. for i = 0, 10 do --Don't need to define a second value type or name, just loops to the second number.
  15.     io.write("Ay lmao"..i);
  16. end
  17.  
  18. --Now.. My favourite. The 'Do while' loop.
  19. repeatVal = 0;
  20. repeat
  21.     io.write("Repeating...");
  22. until repeatVal > 10;
  23.  
  24. -- Repeat until. So sleek.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement