Neopallium / lua-zmq

Lua zeromq2 binding
http://github.com/Neopallium/lua-zmq
MIT License
151 stars 36 forks source link

init a context, but it's nil?? #31

Closed liujianping closed 11 years ago

liujianping commented 12 years ago

I get the latest lua-zmq & libzmq from the git, and install lua-zmq with cmake.

but use lua or luajit :

local zmq = require "zmq" local ctx = zmq.init(1) print(ctx) nil

I install the package on the mac os,

$: otool -L /opt/local/lib/lua/5.1/zmq.so /opt/local/lib/lua/5.1/zmq.so: /usr/local/lib/libzmq.3.dylib (compatibility version 4.0.0, current version 4.0.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 159.1.0)

zmq.so seem link the library succeed, I am really confused...help..

liujianping commented 12 years ago

I reinstall on ubantu, all ok. ctx is nil too.

and test client.lua & server.lua. goes ok.

but test client.lua & server.lua on mac os, both script block. none output....

Neopallium commented 11 years ago

Sorry for the late reply, I didn't notice that e-mail notices where disabled. Most likely got disabled when github changed how notices are handled (watched vs. starred).

The only way you would be getting a nil for ctx is if you are typing that code into Lua or LuaJIT, since 'ctx' is a local. You can't use locals when typing code directly into the Lua or LuaJIT interpretors.

The zmq module registers as the 'zmq' global that is why there wasn't a problem with calling zmq.init(1).

I am not sure why the client/server examples would block on Mac OSX. I don't have a mac to do testing. Try to find out where it is blocking by adding print() statements. Also check if the client script was able to open a connection to the server on port 5555 (use netstat)