API不允许使用特定库(luasocket),也不能通过移动DLL文件包含它的解决方法

我正在使用一个名为Piepan的API,它允许我为Mumble机器人编写Lua脚本。为了方便,它使用了一种另类的Mumble实现Gumble,使用Golang编写。Piepan脚本通过命令行提示符通过piepan.exe执行。 我可以require大多数库,比如inspect.lua,我可以在非piepan脚本(通过lua.exe执行的脚本)中轻松require luasocket,但是如果我尝试require luasocket(或者我真正想要的依赖于luasocket的redis库),我会遇到一个错误。这不是一个错误,而是API缺乏的功能,创作者承认了这一点。创作者建议与这个问题相似的人只是使用Gumble,但是作为Lua程序员,我无法这样做。

下面是我尝试require luasocket的代码:

local socket = require("include-test.socket")

(我也尝试过include-test.socket.core和socket.core)

根据这个stackoverflow答案,我将文件移动到类似于用户自己的目录的位置,所以看起来像这样:

Piepan文件夹
-piepan exe和dlls(不是luasocket dlls)
-include-test(文件夹)
--piepan脚本
--socket.lua
--socket文件夹
---core.dll

尽管目录看起来应该是基于其他用户的问题和答案,但我却遇到了以下错误:

.\include-test\socket.lua:13: module socket.core not found:
    no field package.preload['socket.core']
    Lstat : The system cannot find the path specified.
    GetFileAttributesEx .\socket\core.lua: The system cannot find the path specified.
    GetFileAttributesEx C:\Users\Michael\piepan\lua\socket\core.lua: The system cannot find the path specified.
    GetFileAttributesEx C:\Users\Michael\piepan\lua\socket\core\init.lua: The system cannot find the path specified.
    GetFileAttributesEx C:\Program Files (x86)\Lua\5.1\lua\socket\core.luac: The system cannot find the path specified.,

我也尝试了以下行,受到这个stackoverflow答案的启发。

package.cpath = package.cpath .. ';include-test/?.dll'

但都没有成功。

我正在寻找任何可用的解决方案,无论是移动dll还是编译原始Piepan及其额外文件。 (为了澄清,我需要一种解决方法,允许我在通过piepan运行的同一个脚本中require redis库。使用带有redis库的外部脚本,然后启动piepan并在那里做些事情是对我没有帮助的。)

点赞