lua 文件相互调用

xiaoxiao2025-09-04  233

假设 demo1.lua 想调用 demo2.lua,那么需要在demo2.lua中如下设置:

local _M = {} function _M.test1() return "hello world" end return _M

 

demo1.lua调用:

local demo = require("demo2") demo.test1()

 

转载请注明原文地址: https://www.6miu.com/read-5035726.html

最新回复(0)