1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
|
Description: lua5.2 compat
the lua-scripts here use table.getn(foo) which has been removed in
lua5.2 in favour of "#foo"
Author: IOhannes m zmölnig
Last-Update: 2014-07-21
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- pd-lua.orig/examples/list-pak.pd_lua
+++ pd-lua/examples/list-pak.pd_lua
@@ -48,7 +48,7 @@
-- insert selector
self.stored[i] = sel
else
- if table.getn(atoms) > 0 then
+ if #atoms > 0 then
self.stored[i] = atoms[1]
end
end
--- pd-lua.orig/examples/list-unpack.pd_lua
+++ pd-lua/examples/list-unpack.pd_lua
@@ -50,7 +50,7 @@
-- 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, #atoms)
for i=size, 1, -1 do
self:Outlet(i, atoms[i])
end
--- pd-lua.orig/examples/peekbag.pd_lua
+++ pd-lua/examples/peekbag.pd_lua
@@ -14,7 +14,7 @@
if self.add then
table.insert(self.bag, f)
else
- 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 +59,9 @@
function PeekBag:in_1_aslist()
-- print all values of array as list
- 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 #self.bag > 1 then
self:outlet(1, "list", self.bag)
end
end
|