需要从LUA的另一条路径上的文件
问题在于我找不到要使用的LUA文件。
文件系统看起来像这样:
`|-- plugin
'|-- functions
' -- helpers.lua
|-- tests
'|-- integration
'|-- unit
' -- unittest.lua
`
在UnitTest.lua中,我想使用helpers.lua
package.path = package.path .. ';functions/?.lua'
require('helpers')
,但总会出现错误'no file'。我认为包裹是错误的。如何在unittest.lua脚本中使用helpers.lua脚本?
The problem is that i cant find the lua file to use.
the filesystem looks like this:
`|-- plugin
'|-- functions
' -- helpers.lua
|-- tests
'|-- integration
'|-- unit
' -- unittest.lua
`
in unittest.lua i want to use the helpers.lua like this
package.path = package.path .. ';functions/?.lua'
require('helpers')
but there comes always an error 'no file'. I think the package.path is wrong. How can i use the helpers.lua script inside the unittest.lua script?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
通常,我在与其他两个文件夹所在的同一文件夹中有一个主文件。
首先制作一个名为
mainfile.lua
的文件(您不必命名),然后尝试在
mainfile.lua
中键入此代码(您不必姓名它):文件夹系统应该像这样:
这对我有用,不确定它是否对您有用。
希望这会有所帮助!
usually I have a main file in the same folder as where the other two folders are located.
first make a file named
mainfile.lua
(you don't have to name it that)then try typing this code in
mainfile.lua
(you don't have to name it that):the folder system should look like this:
this works for me, not sure if it will work for you.
hopefully this helps!