Search code examples
lualua-lanes

Lua Lanes linda


I have lanes set up and running just fine but I'm having trouble understanding the linda passing of values, I found this code on the lanes site:

  linda_h:set( key, [val] )
  [val]= linda_h:get( key )

If I do a set/get my application crashes so I'm wondering how I declare the table for set/get?

If I use it as a string then the set/get kind of works but will crash after a few runs of the lane:

 Stop = "0" --outside of lane
 -- start lane
 -- callback function in lane
 if linda_h:get( Stop ) == "1" then
  return 
 end

Does anyone have any pointers here?


Solution

  • The documentation is confusing, but I think you want to use the :send and :receive methods, not :set and :get. Send and receive make the thing behave like an ordinary queue. It seems that :get is like receive except it doesn't remove from the queue, but I'm not sure. And I can't figure out :set at all.