Lua 3rd-Party Libraries Not Loading

Moho allows users to write new tools and plugins. Discuss scripting ideas and problems here.

Moderators: Fahim, Distinct Sun, Víctor Paredes, erey, Belgarath, slowtiger

Post Reply
mminsel
Posts: 4
Joined: Fri Oct 25, 2019 10:38 am

Lua 3rd-Party Libraries Not Loading

Post by mminsel » Fri Nov 15, 2019 12:19 pm

Hi,

I have the following issue:

I'm running Moho 12 on Win 10.
Moho 12 contains Lua version 5.2 x64 (I think.. as _VERSION returns 5.2 and running prebuild libraries with x32 gave me an dll error).

So I compiled the Lua-socket module linking it against version 5.2.4 x64.
I installed it to a dedicated folder and have set the LUA_PATH and LUA_CPATH variable in my CMD.
When I launch Lua in this CMD everything works.
When I now launch Moho from the same CMD and run the following commands from a tool in Moho it doesn't work:

Code: Select all

http = require("socket.http")
r, c, h = http.request{method = "GET", url = "http://www.google.com"}
Instead it complains saying:
Error loading module: /path/to/cpath/socket/core.dll: The module wasn't found.
I wonder if this is a conflict with the internal Lua version? What Patch version is included in Moho 12 and how can I get the exact version number and possibly the arch (x64/x32)? (_VERSION just gives me 5.2)

If the Lua version matches: Is there any restriction in using third-party dlls in the Moho-Lua?

The LUA_PATH, LUA_CPATH and PATH look correct in Moho.
mminsel
Posts: 4
Joined: Fri Oct 25, 2019 10:38 am

Re: Lua 3rd-Party Libraries Not Loading

Post by mminsel » Fri Nov 15, 2019 1:50 pm

I actually recompiled it in x32: I don't get the
Error loading module: /path/to/cpath/socket/core.dll: The module wasn't found.
but only the
Error loading module: /path/to/cpath/socket/core.dll:
So the problem persists
mminsel
Posts: 4
Joined: Fri Oct 25, 2019 10:38 am

Re: Lua 3rd-Party Libraries Not Loading

Post by mminsel » Mon Nov 25, 2019 4:58 pm

I switched to version 13 of Moho. What I get is:

With Lua 5.2.4 and 5.2.0 x64 I still get an immediate crash.

with Lua 5.2.3 and 5.2.1 x64: Error: Multiple Lua VMs detected.

Googling this error gave me two possible reasons:

1. The version of Lua is not exactly the same as the one I'm linking against
2. The Moho executable is not linking lua dynamically

So I guess that the latter may be the cause of the issue.
User avatar
synthsin75
Posts: 7254
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Re: Lua 3rd-Party Libraries Not Loading

Post by synthsin75 » Mon Nov 25, 2019 11:52 pm

Once upon a time, Moho could find dlls in a modules folder in the scripts folder, but I don't think that functionality has worked since, maybe, v10 or older.
As far as I know, Moho uses Lua compiled in its executable, so even if you get it to find another Lua build, it's always going to find that compiled one as well.
Post Reply