-
Hi @apaikan Do you know whether there's the possibility to specify a parameter in the syntax we use to attach a lua script to a connection? @Tobias-Fischer is interested in this. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
There is not yet a standard way to pass the parameters to a portmonitor plugin (lua/C++) at the connection time due to the limitation imposed by YARP carrier syntax. However there are still some ways to do that: Using the YARP administrative commands Using the carrier string parameter
These are formatted as the YARP property and given to the portmonitor -- create is called when the port monitor is created
PortMonitor.create = function(options)
local sourcePort = options:find("source"):asString()
print(sourcePort)
return true;
end Similarly, the $ yarp connect /write /read tcp+recv.portmonitor+type.lua+file.codec+myparam.foo Then, the PortMonitor.create = function(options)
local carrier = options:find("carrier"):asString()
print(carrier)
for attr in string.gmatch(carrier,'([^+]+)') do
k, v = attr:match("([^.]+).([^.]+)")
print(k,v)
end
return true
end You will get:
Ignore the |
Beta Was this translation helpful? Give feedback.
-
Thanks @apaikan! That's great. I'll give it a go soon. |
Beta Was this translation helpful? Give feedback.
-
Thanks @apaikan for the suggestion! |
Beta Was this translation helpful? Give feedback.
There is not yet a standard way to pass the parameters to a portmonitor plugin (lua/C++) at the connection time due to the limitation imposed by YARP carrier syntax.
However there are still some ways to do that:
Using the YARP administrative commands
the parameters can be set/configured after establishing the connection via yarp administrative commands.
Using the carrier string parameter
There are also some predefined attributes which can be accessed from the plugin scripts such as
source
: the source port namedestination
: the destination port namecarrier
: the full carrier stringThese are formatted as the YARP …