建立modul.lua 文件ui
eglua
module ={} module.str ="hello world" local function bar() print("hello bar ") end function module.foo() io.write("hello foo\n") bar() end return module
建立module_test.luaspa
require("module") print(module.str) print(module.foo())
执行结果.net
hello world hello foo hello bar
能够给加载的模块一个别名变量3d
local m =require("module") print(m.str) print(m.foo())
本文同步分享在 博客“羊羽”(other)。
若有侵权,请联系 support@oschina.cn 删除。
本文参与“OSC源创计划”,欢迎正在阅读的你也加入,一块儿分享。code