创建modul.lua 文件
    eg

    1. module ={}
    2. module.str ="hello world"
    3. local function bar()
    4. print("hello bar ")
    5. end
    6. function module.foo()
    7. io.write("hello foo\n")
    8. bar()
    9. end
    10. return module

    创建module_test.lua

    1. require("module")
    2. print(module.str)
    3. print(module.foo())

    执行结果

    1. hello world
    2. hello foo
    3. hello bar

    可以给加载的模块一个别名变量

    1. local m =require("module")
    2. print(m.str)
    3. print(m.foo())