Closed siferati closed 3 years ago
I don't think there is any problem with the module itself (as it's being used by many users in various applications without issues), but possibly an issue with your local setup. For example, socket.core DLL depends on lua DLL, so if it can't find it (because it's locally compiled into your application or for some other reason), you'll likely see this error.
If you need more help, I can suggest the following:
I don't have Lua installed on my computer as it is embedded into mpv. Regular lua scripts work fine, so shouldn't luasocket work as well?
I think the paths are correct, as the file itself is correctly found - it just can't load its module.
I'll write my script, logs and mpv folder structure below so that you can see the paths yourself:
mp.msg.fatal("test")
mp.msg.fatal(package.path)
mp.msg.fatal(package.cpath)
local socket = require("socket")
> mpv test.mp4 --script=%cd% --window-minimized --msg-level=all=warn
[my_mpv_script] test
[my_mpv_script] C:\Users\Tirafesi\Documents\my_mpv_script/?.lua;D:\Tirafesi\Programas\MPV\lua\?.lua;D:\Tirafesi\Programas\MPV\lua\?\init.lua
[my_mpv_script] D:\Tirafesi\Programas\MPV\?.dll;D:\Tirafesi\Programas\MPV\loadall.dll
[my_mpv_script]
[my_mpv_script] stack traceback:
[my_mpv_script] [C]: in function 'require'
[my_mpv_script] D:\Tirafesi\Programas\MPV\lua\socket.lua:12: in main chunk
[my_mpv_script] [C]: in function 'require'
[my_mpv_script] [string "C:\Users\Tirafesi\Documents\my_mpv_script/mai..."]:4: in main chunk
[my_mpv_script] [C]: at 0x002b2de0
[my_mpv_script] [C]: at 0x002b17f0
[my_mpv_script] Lua error: error loading module 'socket.core' from file 'D:\Tirafesi\Programas\MPV\socket\core.dll':
[my_mpv_script] The specified module could not be found.
Yes, everything looks correct, but socket/core.dll depends on lua51.dll (if you are using Lua 5.1), but can't find it since it's embedded into the executable itself (it's probably statically compiled). You'll need to use a "proxy" DLL for your version of Lua. If you are using Lua 5.1, you can use instructions on this page to generate the DLL you need: http://lua-users.org/wiki/LuaProxyDllFour
So do I need to use the dll proxy you linked, or would using the regular lua dll be enough?
Since I can't compile the proxy myself I tried using the regular dll that comes from lua-5.1.5_Win64_bin.zip. I extracted the files, added the folder to PATH but now mpv crashes when requiring luasocket.
The regular DLL won't work, as you end up with two Lua VMs and the interpreter will throw an error. You need a specific Lua proxy dll, but there is no one for 64bit architecture readily available (for example, see this thread: http://lua.2524044.n2.nabble.com/Having-troubles-building-a-dll-for-embedded-interpreter-td7679449.html).
The simplest way would be to modify mpv to compile lua socket in statically, which will help to avoid all these issues.
Hello,
I'm trying to use the compiled luasocket module found on this repo alongside mpv, but I keep getting the error
Lua error: error loading module 'socket.core' from file 'D:\Tirafesi\Programas\MPV\socket\core.dll': the specified module could not be found
.I've tried using both the 32bit and 64bit of luasocket (alongside the respective mpv build) but I get the same error in both cases.
My lua script simply contains
local socket = require("socket")
.