Lua 请求 HTTP 模块

我正在尝试使用 Lua 脚本从网页中检索值。我在 Windows 10 上使用 Lua 5.4 在 VSCode 中。我尝试使用 LuaSocket(将其设置为我的主要脚本所在的文件夹),但它只响应以下错误:

C:\lua\lua54.exe: .\socket.lua:12: module 'socket.core' not found:
        no field package.preload['socket.core']
        no file 'C:\lua\lua\socket\core.lua'
        no file 'C:\lua\lua\socket\core\init.lua'
        no file 'C:\lua\socket\core.lua'
        no file 'C:\lua\socket\core\init.lua'
        no file 'C:\lua\..\share\lua\5.4\socket\core.lua'
        no file 'C:\lua\..\share\lua\5.4\socket\core\init.lua'
        no file '.\socket\core.lua'
        no file '.\socket\core\init.lua'
        no file 'C:\lua\socket\core.dll'
        no file 'C:\lua\..\lib\lua\5.4\socket\core.dll'
        no file 'C:\lua\loadall.dll'
        no file '.\socket\core.dll'
        no file 'C:\lua\socket\core54.dll'
        no file '.\socket\core54.dll'
        no file 'C:\lua\socket.dll'
        no file 'C:\lua\..\lib\lua\5.4\socket.dll'
        no file 'C:\lua\loadall.dll'
        no file '.\socket.dll'
        no file 'C:\lua\socket54.dll'
        no file '.\socket54.dll'
stack traceback:
        [C]: in function 'require'
        .\socket.lua:12: in main chunk
        [C]: in function 'require'
        .\http.lua:10: in main chunk
        [C]: in function 'require'

我做错了什么吗?

原文链接 https://stackoverflow.com/questions/71292412

点赞