File: localsend.pd_lua

package info (click to toggle)
pd-lua 0.12.23%2Bds-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,912 kB
  • sloc: ansic: 3,733; lisp: 66; makefile: 64
file content (23 lines) | stat: -rw-r--r-- 610 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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