试图与LuaDist打交道。
按照上的说明,通过使用以下方法构建一个新部署来测试安装:
cd _install\bin
luadist C:\my_lua install lua luasocket md5
cd C:\my_lua\bin
lua -e "require 'md5'"
但是,我得到以下错误消息:
Finding out available versions of lua...
Getting lua-5.3.2 (source)...
Finding out available versions of luasocket...
Getting
我使用LuaForWindows (最新版本),并阅读了和的答案以及在lua-users.org的中可以找到的所有内容。无论我尝试什么(大多数)网站,都只能回复301或302。我创建了一个示例批处理脚本,它从手册页下载(部分) OpenGL 2.1引用。
@ECHO OFF
FOR /F "SKIP=5" %%# IN ( %~fs0 ) DO lua -l socket.http -e "print(socket.http.request('https://www.opengl.org/sdk/docs/man2/xhtml/%%#.xml'))
我试图让luasocket在的lua脚本环境中工作,但到目前为止还没有成功。我下载了luasocket 的版本,确保安装了vc8,并检查了bizhawk: 5.1附带的lua版本。
但是,当我启动脚本时,我会得到以下错误:
LuaInterface.LuaScriptException: error loading module 'socket.core' from file './libs/socket\core.dll':
Das angegebene Modul wurde nicht gefunden. (the given module was
当我在终端中运行我的代码时,我得到这个错误/消息:
module 'socket.http' not found:
no field package.preload['socket.http']
no file '/usr/local/share/lua/5.2/socket/http.lua'
no file '/usr/local/share/lua/5.2/socket/http/init.lua'
no file '/usr/local/lib/lua/5.2/socket/
当我尝试在Ubuntu上使用LuaSocket创建一个监听任何端口的套接字时,套接字的创建失败,并显示"permission denied":
require("socket")
server, msg = socket.bind("*", 23)
if not server then print(msg) end
但是,当以超级用户身份(使用sudo)执行相同的脚本时,服务器的创建工作正常。有没有什么原因导致LuaSocket无法正常创建服务器?我可以做任何事情(无论是在Lua还是在Ubuntu服务器上),这样就不需要以超级用户身份执行脚本
我安装了luarocks,现在我尝试使用它来安装luasocket。
我的命令是
luarocks install luasocket-2.0.2-3.win32-x86.rock
我得到的回应是
C:\Program Files (x86)\LuaRocks\lua\luarocks\command_line.lua:186: bad argument #1 to 'require' (string expected, got table)
command_line.lua中给出麻烦的代码行是
if commands[command] then
local cmd =
我正在尝试更新程序,所以当我的Lua应用程序过时时,它将使用LuaSocket下载更新的.exe文件(它可以运行我的Lua代码)。
在这个更新程序中,我希望它显示到目前为止已经下载了多少。但是,使用以下HTTP请求,它会阻塞应用程序,直到完全下载:
local b, c, h = http.request("https://www.example.com/Download/Example.exe?from="..Game.Version)
我使用线程下载它,但我仍然不能写到文件,直到下载完成在线程内,因此进度条将达到0%,100%,没有任何之间的任何东西。
我能做些什么来下载远