-
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 that's needed is a `[; pdluax reload(` message in your patch, or you can use the pd-remote.pd abstraction, as described in the tutorial. To make it possible to load pdx.lua from pd.lua (and possibly other extension modules in the future), the pdlua external directory is now always on Lua's `package.path`. Hence it was possible to revert pd._setrequirepath() to take only one argument. Note that if you don't want this, you can still disable pdx.lua globally by commenting out the following line near the end of pd.lua: pdx = require 'pdx' Or you can call pdx.unreload() in the initialize() method of your object. But this shouldn't be necessary. pdx.lua incurs minimal overhead, and even with pdx.lua pre-loaded, you can still use any of the other live-coding approaches described in the tutorial if you prefer.
- 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. | ||
|