Guest User

Untitled

a guest
Mar 19th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. -- modules
  2. -- a package is a collection of modules
  3.  
  4. local test = {}
  5.  
  6. function test.add(n1, n2) -- dont put local as the scope of this function
  7. since you already added
  8. -- a local to the 'test' table... doing so will return an error
  9. return n1 + n2
  10. end
  11.  
  12. function test.hi(name)
  13. return "my name is " .. name
  14. end
  15.  
  16. return test
  17.  
  18. print("===========================")
  19.  
  20. local dad = require("kek13")
  21.  
  22. print(dad.hi("A"))
  23.  
  24. print(dad.add(1, 5))
  25.  
  26. print("==============================")
  27.  
  28. require ("kek13")
  29.  
  30. print(dad.hi("ur mum"))
  31. print(dad.add(2, 2))
  32.  
  33. print("========================================")
Add Comment
Please, Sign In to add comment