[PD] pdlua output
claudiusmaximus at goto10.org
Wed Jan 30 16:53:54 CET 2008
> now i want to be able to send the message [greaterthan score 3(
> so in the code where it says "score=(%d+)")) - i need "score" to be
> variable from second part of the message the ">1" needs to be a
> variable from the 3rd part of the message
The Lua operator .. is string concatenation, so you can do:
"foo" .. "bar"
> i know its somewhere within the () below but i cant seem to get it right
> function M:in_1_greaterthan()
> rob c
-- called when "greaterthan" message is received at first inlet
-- atoms is a table of the atoms in the message following the selector
local name = atoms -- could be: "score"
local value = atoms -- could be: 3
if name ~= nil and value ~= nil then -- could check types too..
-- do your stuff here
If you have a range of possible selectors, and don't want to have to
write a method for all of them, you can use:
function M:in_1(selector, atoms) ... end
Then selector will be "greaterthan" (or whatever) and atoms will be as
More specific methods are called before less specific methods, read
pd.lua to see how that works (it's in the dispatcher function(s)).
Hope this helps,
More information about the Pd-list