我在使用lua require功能时遇到麻烦。我要的文件位于
../ node_modules / lua-hill / modules / globals.lua
我得到的错误是:LuaError: Module 'globals' not found!
我的代码:
package.path = '../node_modules/lua-hill/modules/?.lua;' .. package.path
local test = require("globals")
> tmp = require "tmp"
stdin:1: module 'tmp' not found:
no field package.preload['tmp']
no file 'C:\lua\lua\tmp.lua'
no file 'C:\lua\lua\tmp\init.lua'
no file 'C:\lua\tmp.lua'
no file 'C:\lua\tmp\init.lua'
no file 'C:\lua\..\share\lua\5.3\tmp.lua'
no file 'C:\lua\..\share\lua\5.3\tmp\init.lua'
no file '.\tmp.lua'
no file '.\tmp\init.lua'
no file 'C:\lua\tmp.dll'
no file 'C:\lua\..\lib\lua\5.3\tmp.dll'
no file 'C:\lua\loadall.dll'
no file '.\tmp.dll'
stack traceback:
[C]: in function 'require'
stdin:1: in main chunk
[C]: in ?
因此,您可以在此信息中检查您的加载路径。