Skip to content
Snippets Groups Projects
Commit 4a522e5f authored by Albert Gräf's avatar Albert Gräf
Browse files

pd.lua: Lua 5.3 compatibility

parent 6de6bb00
No related branches found
No related tags found
No related merge requests found
...@@ -269,7 +269,7 @@ function pd.Class:destruct() ...@@ -269,7 +269,7 @@ function pd.Class:destruct()
end end
function pd.Class:dispatch(inlet, sel, atoms) function pd.Class:dispatch(inlet, sel, atoms)
local m = self["in_" .. inlet .. "_" .. sel] local m = self[string.format("in_%d_%s", inlet, sel)]
if type(m) == "function" then if type(m) == "function" then
if sel == "bang" then return m(self) end if sel == "bang" then return m(self) end
if sel == "float" then return m(self, atoms[1]) end if sel == "float" then return m(self, atoms[1]) end
...@@ -287,7 +287,7 @@ function pd.Class:dispatch(inlet, sel, atoms) ...@@ -287,7 +287,7 @@ function pd.Class:dispatch(inlet, sel, atoms)
if sel == "list" then return m(self, inlet, atoms) end if sel == "list" then return m(self, inlet, atoms) end
return m(self, inlet, atoms) return m(self, inlet, atoms)
end end
m = self["in_" .. inlet] m = self[string.format("in_%d", inlet)]
if type(m) == "function" then if type(m) == "function" then
return m(self, sel, atoms) return m(self, sel, atoms)
end end
...@@ -296,9 +296,8 @@ function pd.Class:dispatch(inlet, sel, atoms) ...@@ -296,9 +296,8 @@ function pd.Class:dispatch(inlet, sel, atoms)
return m(self, inlet, sel, atoms) return m(self, inlet, sel, atoms)
end end
self:error( self:error(
"no method for `" .. sel .. string.format("no method for `%s' at inlet %d of Lua object `%s'",
"' at inlet " .. inlet .. sel, inlet, self._name)
" of Lua object `" .. self._name .. "'"
) )
end end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment