-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Pre-load pdx.lua and enable live-coding support by default.
Following up on rev. 7447be5, pdx.lua is now pre-loaded in pd.lua, and all objects have live-coding enabled automatically, by calling pdx.reload() immediately before intiialize(). Thus all you need is a `[; pdluax reload(` message in your patch, and Bob's your uncle. Or you can add an instance of the pd-remote.pd abstraction, as described in the tutorial, if you also want to remotely control script reloads through your editor. You can still disable this globally by commenting out the following line near the end of pd.lua: pdx = require 'pdx' Or you can disable reloads on a per-object basis by calling pdx.unreload() in the intiialize() method. But why would you want to? pdx.lua is well-tested at this point, incurs minimal overhead, and is by far the easiest live-coding solution for pd-lua. Also, even with pdx.lua pre-loaded, you can still use any of the other live-coding approaches described in the tutorial if you prefer. To make it possible to load pdx.lua from pd.lua (and possibly other extension modules in the future), the extra/pdlua directory is now always on Lua's `package.path`. Hence it was possible to revert pd._setrequirepath() to take only one argument. (The present code won't modify package.cpath, however. But this is fine with pdx.lua which is a pure Lua module. And we can still add to package.cpath if a future extension requires mixed Lua+C.)
- Loading branch information
Showing
4 changed files
with
55 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,10 +3,8 @@ | |
pdx.lua: useful extensions to pd.lua | ||
Copyright (C) 2020 Albert Gräf <[email protected]> | ||
To use this in your pd-lua scripts: local pdx = require 'pdx' | ||
Currently there's only the pdx.reload() function, which implements a kind of | ||
remote reload functionality based on dofile and receivers, as explained in the | ||
live coding functionality based on dofile and receivers, as explained in the | ||
pd-lua tutorial. More may be added in the future. | ||
This program is free software; you can redistribute it and/or | ||
|
@@ -30,6 +28,13 @@ local pdx = {} | |
Reload functionality. Call pdx.reload() on your object to enable, and | ||
pdx.unreload() to disable this functionality again. | ||
NOTE: As of pd-lua 0.12.8, this module is now pre-loaded, and pdx.reload() | ||
gets called automatically before running the initialize method of any object, | ||
so calling pdx.reload() explicitly is no longer needed. (Old code importing | ||
the module and doing the call will continue to work, though.) Instead, you | ||
will now have to call pdx.unreload() in your initialize method if you want to | ||
*disable* this feature for some reason. | ||
pdx.reload installs a "pdluax" receiver which reloads the object's script file | ||
when it receives the "reload" message without any arguments, or a "reload | ||
class" message with a matching class name. | ||
|