[PD] Lua: request for 'require'...

Mike McGonagle mjmogo at gmail.com
Tue May 20 19:19:45 CEST 2008

On Tue, May 20, 2008 at 1:18 AM, Frank Barknecht <fbar at footils.org> wrote:

> Hallo,
> Mike McGonagle hat gesagt: // Mike McGonagle wrote:
> > On 5/19/08, Claude Heiland-Allen <claudiusmaximus at goto10.org> wrote:
> > > Mike McGonagle wrote:
> > >  There is support for one-off execution of .lua scripts found via Pd's
> path
> > > (relative to the object instance, not the original source file), use it
> like
> > > self:dofile("myscript.lua").
> >
> > So, can I assume that this would effectively be the same as using
> > "require"? I am sure there will be differences, but I am not trying to
> > load a compiled binary, just curious if this has the same effect for
> > .lua files...
> As a workaround for now you could modify the Lua search path manually
> using something like:
> package.path = "/my/pdlua/files/?.lua;" .. package.path

Cool, I will check it out...

> before any requires. This adds the pattern "/my/pdlua/files/?.lua" to
> the path require() searches for modules. Lua doesn't know about
> directories, so you cannot us something like "pwd" instead here, of
> course.
> Do you think it would make sense to push the directory of a *.pd_lua
> file to the front of package.path automatically? I guess I think it
> would.

Yes, I think that something like this would be taken care of by the
"environment", as this would force any and all code used in PD to be
specific to PD, having to add code that is only used in PDLua. Also
considering that PD allows you to load something from the same directory,
then PDLua I would think should too. How is Vessel handling 'require'?


> Ciao
> --
>  Frank Barknecht                                     _ ______footils.org__
> _______________________________________________
> PD-list at iem.at mailing list
> UNSUBSCRIBE and account-management ->
> http://lists.puredata.info/listinfo/pd-list

Peace may sound simple—one beautiful word— but it requires everything we
have, every quality, every strength, every dream, every high ideal.
—Yehudi Menuhin (1916–1999), musician
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20080520/23486e42/attachment.htm>

More information about the Pd-list mailing list