"模块'socket.http'未找到:" - 管理iMac上的

Ale*_*lex 7 sockets macos lua luasocket

当我在终端中运行我的代码时,我收到此错误/消息:

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/http.lua' 
    no file '/usr/local/lib/lua/5.2/socket/http/init.lua' 
    no file './socket/http.lua' 
    no file '/usr/local/lib/lua/5.2/socket/http.so' 
    no file '/usr/local/lib/lua/5.2/loadall.so' 
    no file './socket/http.so' 
    no file '/usr/local/lib/lua/5.2/socket.so' 
    no file '/usr/local/lib/lua/5.2/loadall.so' 
    no file './socket.so'
Run Code Online (Sandbox Code Playgroud)

一些消息来源让我调查LuaSocket,但我仍然不知道该做什么或如何安装它.

hjp*_*r92 8

有几个地方可以使用安装LuaSocket的指南.其中一些列出如下:

我首选的方法是安装LuaRocks,然后在终端中使用以下命令:

luarocks install luasocket
Run Code Online (Sandbox Code Playgroud)