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

Frank Barknecht fbar at footils.org
Tue May 20 08:18:12 CEST 2008


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

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. 

Ciao
-- 
 Frank Barknecht                                     _ ______footils.org__




More information about the Pd-list mailing list