Guest User

Untitled

a guest
May 20th, 2018
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. require "pippo"
  2.  
  3. a = 17
  4. b = 22
  5. a = "ciao"
  6. b = a .. " mondo"
  7.  
  8. -- adder is a reference to a function
  9. adder = function(first, second)
  10. return first + second
  11. end
  12.  
  13. function adder2(first, second)
  14. local boh = 50
  15. return first + second
  16. end
  17.  
  18. print(adder(1, 2))
  19.  
  20. foobar = {}
  21. foobar.dumbadder = adder2
  22.  
  23. print(foobar.dumbadder(3, 4))
  24.  
  25. print(pippo.multiplier(4, 5))
  26.  
  27. arr = {"ciao", "foo"}
  28.  
  29. for k,v in pairs(_G) do
  30. print(k, v)
  31. end
  32.  
  33. print(math.sin( 50 ))
  34.  
  35. mt = {}
  36. mt.__add = function(a, b)
  37. if type(a.key) == "string" then
  38. return a.key .. b.key3
  39. end
  40. return a.value + b.value
  41. end
  42.  
  43. t1 = {key="foo", key2="bar", value=50}
  44. setmetatable(t1, mt)
  45. t2 = {key3="test", key4="test2", value=90}
  46.  
  47. print(t1 + t2)
Add Comment
Please, Sign In to add comment