-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Integrate Ben's section on dollar symbol expansion, add example.
- Loading branch information
Showing
6 changed files
with
120 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#N canvas 580 203 398 197 12; | ||
#X declare -lib pdlua; | ||
#X obj 240 110 tgl 20 0 empty \$0-onoff empty 17 7 0 10 #dfdfdf #000000 | ||
#000000 1 1; | ||
#X floatatom 240 144 5 0 0 0 - - -, f 5; | ||
#X obj 40 120 bng 20 250 50 0 empty empty empty 17 7 0 10 #dfdfdf #000000 | ||
#000000; | ||
#X text 68 119 <-- click me; | ||
#X obj 175 19 declare -lib pdlua; | ||
#X obj 40 154 localsend \$0-onoff; | ||
#X obj 290 110 tgl 20 0 empty onoff empty 17 7 0 10 #dfdfdf #000000 | ||
#000000 0 1; | ||
#X floatatom 290 144 5 0 0 0 - - -, f 5; | ||
#X msg 40 50 sender \\\$0-onoff; | ||
#X msg 40 80 sender onoff; | ||
#X connect 0 0 1 0; | ||
#X connect 2 0 5 0; | ||
#X connect 6 0 7 0; | ||
#X connect 8 0 5 0; | ||
#X connect 9 0 5 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
local localsend = pd.Class:new():register("localsend") | ||
|
||
function localsend:initialize(sel, atoms) | ||
self.inlets = 1 | ||
-- pass the symbol from the creation argument, | ||
-- which gets automatically expanded here | ||
self.sender = tostring(atoms[1]) | ||
return true | ||
end | ||
|
||
function localsend:in_1_sender(x) | ||
local sendername = tostring(x[1]) | ||
|
||
-- store the original name as argument (like "\$0-foo") | ||
self:set_args({sendername}) | ||
|
||
-- apply the expanded name with the local id | ||
self.sender = self:canvas_realizedollar(sendername) | ||
end | ||
|
||
function localsend:in_1_bang() | ||
pd.send(self.sender, "bang", {}) | ||
end |
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.