Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- modules
- -- a package is a collection of modules
- local test = {}
- function test.add(n1, n2) -- dont put local as the scope of this function
- since you already added
- -- a local to the 'test' table... doing so will return an error
- return n1 + n2
- end
- function test.hi(name)
- return "my name is " .. name
- end
- return test
- print("===========================")
- local dad = require("kek13")
- print(dad.hi("A"))
- print(dad.add(1, 5))
- print("==============================")
- require ("kek13")
- print(dad.hi("ur mum"))
- print(dad.add(2, 2))
- print("========================================")
Add Comment
Please, Sign In to add comment