Skip to content

Commit

Permalink
pdx.lua: Don't register pdlua and pdluax as reloadables.
Browse files Browse the repository at this point in the history
We don't want to accidentally reload these, because they aren't regular
(.pd_lua) objects which dofilex() can manage. (dofilex will actually
crash and burn when invoked on these.)
  • Loading branch information
agraef committed Sep 4, 2024
1 parent 393b855 commit 61bd5de
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions pdlua/tutorial/examples/pdx.lua
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ end
-- the script, as well as invoking some callbacks before and afterwards which
-- provide hooks for user customizations.
local function pdluax(self, sel, atoms)
if sel == "reload" and not string.match(self._scriptname, ".pd_luax$") then
if sel == "reload" then
-- reload message, check that any extra argument matches the class name
if atoms[1] == nil or atoms[1] == self._name then
-- iterate over *all* objects in this class and invoke their
Expand Down Expand Up @@ -205,8 +205,10 @@ function pdx.reload(self)
reloadables[self._name][self] = { finalize = self.finalize }
self.finalize = finalize
end
else
-- New class, make this the default receiver.
elseif self._name ~= "pdlua" and self._name ~= "pdluax" then
-- New class, make this the default receiver. Note that since dofilex()
-- is designed for regular (.pd_lua) objects only, we explicitly exclude
-- the built-in pdlua and pdluax classes here, to prevent crashes.
reloadables[self._name] = { current = self }
reloadables[self._name][self] = { finalize = self.finalize }
-- install our finalizer
Expand Down

0 comments on commit 61bd5de

Please sign in to comment.