lua文件调用lua 中的文件调用主要使用的函数有 dofile 和 require1 对于同一目录下的文件调用 nbsp nbsp nbsp nbsp 例如同一目录下的 a lua b lua 两个文件 nbsp nbsp nbsp nbsp a 文件调用 b 文件可以在 a 文件编写 dofile b lua 或者 require b 2 对于不同目录下的文件调用 nbsp nbsp 例如 gt one nbsp nbsp nbsp nbsp nbsp nbsp nbsp nbsp nbsp nbsp nbsp nbsp nbsp nbsp nbsp nbsp nbsp nbsp a lua nbsp nbsp nbsp nbsp nbsp nbsp nbsp nbsp nbsp nbsp nbsp nbsp nbsp gt
lua中的文件调用主要使用的函数有dofile和require
1.对于同一目录下的文件调用
例如 同一目录下的a.lua,b.lua两个文件
a文件调用b文件 可以在a文件编写dofile(“b.lua”)或者require(“b”)
2.对于不同目录下的文件调用
在a文件调用b文件 可以在a文件编写dofile(“.//two//b.lua”)
如果要是使用require则需要制定lua搜索路径 推荐详读《lua程序设计》里第15章:模块与包
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。
发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/200671.html原文链接:https://javaforall.net