aboutsummaryrefslogtreecommitdiff
path: root/examples/peekbag.pd_lua
diff options
context:
space:
mode:
authorMartin Peach <mrpeach@users.sourceforge.net>2014-07-21 18:46:54 +0000
committerIOhannes m zmölnig <zmoelnig@iem.at>2015-10-14 14:28:31 +0200
commit587333d0b28fbf115783c3de34bc6bf271e06a9d (patch)
treec7b09d31dd16cad3f7e07581ed58118b1de8f7c2 /examples/peekbag.pd_lua
parent349e81ecd8ec307c187c0ff4abf0788f381a3087 (diff)
replaced deprecated(Lua5.1) and missing(Lua5.2) table.getn() with the length operator # to obtain length of tables.
svn path=/trunk/externals/loaders/pdlua/; revision=17330
Diffstat (limited to 'examples/peekbag.pd_lua')
-rw-r--r--examples/peekbag.pd_lua9
1 files changed, 6 insertions, 3 deletions
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