我想在Windows 7上使用ZeroBraneStudio 1.4和我自己的lua解释器(5.1)调试我的应用程序。
我将解释器设置为user.lua
为
path.lua = '<PATH_OWN_INTERPRETER>'
my_app.lua
将以下内容作为第一行
package.path = package.path .. ';../CommonScripts/?.lua'
print(package.path)
打印
;.\?.lua;<PATH_OWN_INTERPRETER>\lua\?.lua;<PATH_OWN_INTERPRETER>\lua\?\init.lua;<PATH_OWN_INTERPRETER>\?.lua;<PATH_OWN_INTERPRETER>\?\init.lua;./?.lua;./?/init.lua;./lua/?.lua;./lua/?/init.lua;<PATH_ZBS>\lualibs/?/?.lua;<PATH_ZBS>\lualibs/?.lua;<PATH_ZBS>\lualibs/?/?/init.lua;<PATH_ZBS>\lualibs/?/init.lua;../CommonScripts/?.lua
当我开始调试时,会发生以下错误。
<PATH_ZBS>\lualibs/ssl.lua:19: module 'ssl.x509' not found:
no field package.preload['ssl.x509']
no file '.\ssl\x509.lua'
no file '<PATH_OWN_INTERPRETER>\lua\ssl\x509.lua'
no file '<PATH_OWN_INTERPRETER>\lua\ssl\x509\init.lua'
no file '<PATH_OWN_INTERPRETER>\ssl\x509.lua'
no file '<PATH_OWN_INTERPRETER>\ssl\x509\init.lua'
no file './ssl\x509.lua'
no file './ssl\x509/init.lua'
no file './lua/ssl\x509.lua'
no file './lua/ssl\x509/init.lua'
no file '<PATH_ZBS>\lualibs/ssl\x509/ssl\x509.lua'
no file '<PATH_ZBS>\lualibs/ssl\x509.lua'
no file '<PATH_ZBS>\lualibs/ssl\x509/ssl\x509/init.lua'
no file '<PATH_ZBS>\lualibs/ssl\x509/init.lua'
no file '../CommonScripts/ssl\x509.lua'
no file '.\ssl\x509.dll'
no file '.\ssl\x50951.dll'
no file '<PATH_OWN_INTERPRETER>\ssl\x509.dll'
no file '<PATH_OWN_INTERPRETER>\ssl\x50951.dll'
no file '<PATH_OWN_INTERPRETER>\clibs\ssl\x509.dll'
no file '<PATH_OWN_INTERPRETER>\clibs\ssl\x50951.dll'
no file '<PATH_OWN_INTERPRETER>\loadall.dll'
no file '<PATH_OWN_INTERPRETER>\clibs\loadall.dll'
no file '<PATH_ZBS>\bin/ssl\x509.dll'
no file '<PATH_ZBS>\bin/clibs/ssl\x509.dll'
no module 'ssl.x509' in file '<PATH_OWN_INTERPRETER>\ssl.dll'
stack traceback:
[C]: in function 'require'
<PATH_ZBS>\lualibs/ssl.lua:19: in main chunk
[C]: in function 'require'
<PATH_OWN_INTERPRETER>\ssl\https.lua:10: in main chunk
[C]: in function 'require'
../CommonScripts/Class2.lua:36: in main chunk
[C]: in function 'require'
../CommonScripts/Class1.lua:40: in main chunk
[C]: in function 'require'
my_app.lua:48: in main chunk
我在Class2.lua:36
local https = require'ssl.https'
似乎ZBS正在将内置Lua解释器的目录与我想要使用的目录混合在一起。
我该如何防止这种情况?
答案 0 :(得分:0)
@EgorSkriptunoff在他的评论中是正确的:你有<PATH_OWN_INTERPRETER>\ssl.dll
,它似乎没有ssl.x509
模块(no module 'ssl.x509' in file '<PATH_OWN_INTERPRETER>\ssl.dll'
)且没有<PATH_OWN_INTERPRETER>\ssl.lua
,因此模块的Lua版本是从ZeroBrane Studio文件夹加载的,但是模块的二进制部分是从Lua文件夹加载的并且丢失了(由于某种原因x509组件)。您需要使用来自同一来源的两个(Lua和二进制)组件。
答案 1 :(得分:0)
显然当user.lua
中的lua路径设置为
path.lua = '<PATH_OWN_INTERPRETER>'
它由ZeroBrane Studio扩展为
<PATH_OWN_INTERPRETER>\lua\?.lua;
<PATH_OWN_INTERPRETER>\lua\?\init.lua;
<PATH_OWN_INTERPRETER>\?.lua;
<PATH_OWN_INTERPRETER>\?\init.lua;
在我自己的翻译中,ssl位于<PATH_OWN_INTERPRETER>\lua\ssl\ssl.lua
,并未包含在上面的列表中。
所以,我的解决方案是将LUA_PATH
定义为环境变量,以便我得到
<PATH_OWN_INTERPRETER>/?.lua;
<PATH_OWN_INTERPRETER>/lua/?.lua;
<PATH_OWN_INTERPRETER>/lua/?/?.lua;
在路径中。