1

Bear with me, as I'm not a pro by any means.

I've known about ZeroMQ for a while, and that it offers a very interesting way of utilizing multiple cores by clever use of networking. I'd like to see what I can get going with it, as the lua examples provided are extremely concise and easy to understand.

But adding ZeroMQ as a lua library...Not so much. There are no instructions at all. Closest I could find, were Linux commands to download the repo and add it to the OS' libraries.

The problem, is that I'm on Windows. Nor do the instructions actually say how you add it to a lua project. Never mind how to add it to an IDE, like Zerobrane.

How do I go about this?

FiftyTifty
  • 91
  • 1
  • 7

1 Answers1

1

I think there are two part to this question: (1) how to add ZeroMQ as a library to a Lua script and (2) how to make it run from ZeroBrane Studio.

(1) To add ZeroMQ as a Lua library you need to use some ZeroMQ binding (essentially a wrapper around ZeroMQ library that provides Lua methods to use). I see two options: https://github.com/zeromq/lzmq and https://github.com/Neopallium/lua-zmq. You'll have to figure out how to compile one of them on Windows and generate .dll library that can be loaded by your Lua application.

(2) When you have the ZeroMQ library and its Lua binding library (they will usually be available as one .dll library), you don't need to do anything special to make it run from ZeroBrane Studio. If you can run your ZeroMQ sample from the current folder, then select that as the project folder in ZeroBrane Studio and run your script. That should be enough.

Make sure that your ZeroMQ binding is compiled against the same version of Lua you plan to use. For example, if you're using Lua 5.3, then the binding needs to be compiled against that version (and requires the support for that version in the ZeroMQ bindings).

Paul Kulchenko
  • 25,884
  • 3
  • 38
  • 56
  • And that's the problem; there's no instructions on how to go through this. Vague console commands for Linux don't really translate well to compiling ZeroMQ. Then there's the vague LuaJIT version used by ZeroBrane, which is just called "Lua", with the non-JIT interpreters having their Lua versions specified – FiftyTifty Oct 29 '21 at 00:06
  • 1
    It doesn't matter if it's Lua 5.1 or LuaJIT, as they are ABI-compatible and as long as the library is compiled against Lua 5.1 dll, it should all work. You are not limited to LuaJIT in any way, as this is the version that the IDE itself is using, but it will debug any Lua version, so you can run whatever you need. See the relevant section in the documentation: https://studio.zerobrane.com/doc-general-preferences#interpreter-path – Paul Kulchenko Oct 29 '21 at 05:34