diff options
Diffstat (limited to 'examples')
-rw-r--r-- | examples/list-pak.pd_lua | 3 | ||||
-rw-r--r-- | examples/list-unpack.pd_lua | 3 | ||||
-rw-r--r-- | examples/peekbag.pd_lua | 9 |
3 files changed, 10 insertions, 5 deletions
diff --git a/examples/list-pak.pd_lua b/examples/list-pak.pd_lua index 1651582..5964b33 100644 --- a/examples/list-pak.pd_lua +++ b/examples/list-pak.pd_lua @@ -48,7 +48,8 @@ function ListPak:in_n(i, sel, atoms) -- insert selector self.stored[i] = sel else - if table.getn(atoms) > 0 then +-- if table.getn(atoms) > 0 then + if #(atoms) > 0 then self.stored[i] = atoms[1] end end diff --git a/examples/list-unpack.pd_lua b/examples/list-unpack.pd_lua index 08b635c..ebddc45 100644 --- a/examples/list-unpack.pd_lua +++ b/examples/list-unpack.pd_lua @@ -50,7 +50,8 @@ function ListUnpack:in_1(sel, atoms) -- also unpack selector of anythings table.insert(atoms, 1, sel) end - local size = math.min(self.outlets, table.getn(atoms)) +-- local size = math.min(self.outlets, table.getn(atoms)) + local size = math.min(self.outlets, #(atoms)) for i=size, 1, -1 do self:Outlet(i, atoms[i]) end diff --git a/examples/peekbag.pd_lua b/examples/peekbag.pd_lua index 15e4791..c37a0a3 100644 --- a/examples/peekbag.pd_lua +++ b/examples/peekbag.pd_lua @@ -14,7 +14,8 @@ function PeekBag:in_1_float(f) if self.add then table.insert(self.bag, f) else - for i=table.getn(self.bag),1,-1 do +-- for i=table.getn(self.bag),1,-1 do + for i = #(self.bag), 1, -1 do if self.bag[i]==f then table.remove(self.bag, i) break @@ -59,9 +60,11 @@ end function PeekBag:in_1_aslist() -- print all values of array as list - if table.getn(self.bag) == 1 then +-- if table.getn(self.bag) == 1 then + if #(self.bag) == 1 then self:outlet(1, "float", {self.bag[1]}) - elseif table.getn(self.bag) > 1 then +-- elseif table.getn(self.bag) > 1 then + elseif #(self.bag) > 1 then self:outlet(1, "list", self.bag) end end |