One lua function for multiple plugins

Typically: "How do I... ", "How can I... " questions
Post Reply
ahundt
Posts: 112
Joined: 29 Jan 2015, 04:21

One lua function for multiple plugins

Post by ahundt »

I'd like to create a lua function that calls multiple separate plugins with the same data. In this case it is to initialize a "robot" with the strings for the various joints and ik group. I need the message to go to my driver plugin and inverse kinematics plugin, for example. Is this possible?

Do I use the normal register functions supplied with the latest vrep perhaps and just call register for both plugins, or would I need a different approach because the multiple registrations would collide?

coppelia
Site Admin
Posts: 10378
Joined: 14 Dec 2012, 00:25

Re: One lua function for multiple plugins

Post by coppelia »

Hello,

yes, this is possible. You need to:
  • in each plugin, register the same custom lua function. The last registration is the one that will be called-back. This means that only one plugin will be called back.
  • in each plugin callback routine (actually you don't know at first which plugin will be called back) call simBroadcastMessage.
  • each plugin will receive the broadcast message
Cheers

Post Reply