[PD] new luagl

Frank Barknecht fbar at footils.org
Sun Jul 27 11:51:15 CEST 2008


Hallo,
Claude Heiland-Allen hat gesagt: // Claude Heiland-Allen wrote:

> marius schebella wrote:
> > error: lua: error loading `msgltest1':
> > [string "msgltest1"]:1: module 'opengl' not found:
> >     no field package.preload['opengl']
> >     no file '/Users/marius/pd/pdlua/opengl'
> >     no file '/Users/marius/pd/pdlua/opengl.lua'
> >     no file './opengl.lua'
> >     no file '/usr/local/share/lua/5.1/opengl.lua'
> >     no file '/usr/local/share/lua/5.1/opengl/init.lua'
> >     no file '/usr/local/lib/lua/5.1/opengl.lua'
> >     no file '/usr/local/lib/lua/5.1/opengl/init.lua'
> >     no file './opengl.so'
> >     no file '/usr/local/lib/lua/5.1/opengl.so'
> >     no file '/usr/local/lib/lua/5.1/loadall.so'
> > 
> > it seems pdlua is only looking for the "so" extension in /usr/local/lib...
> > creating a symlink without the extension solved this for now.
> > marius.
> 
> aha, many thanks for the additional info! - seems that this is a bug in 
> pdlua after all:
> 
> when pdlua loads a script it sets Lua's package path like this:
> 
> /* package.path := path .. "/?;" .. path .. "/?.lua;" .. package.path */
> 
> I'm not sure the best way to fix this, the standalone 'lua' interpreter 
> doesn't mention .so in the package path at all:

Lua's package has a different key for binary, C-modules called
package.cpath, which corresponds to the environment variable
LUA_CPATH.

I think, this is something which changed from Lua 5.0 to Lua 5.1, at
least it isn't mentioned in the first edition of the Blue PiL (online
on lua.org). If you don't have the second edition, you can get the
rewritten chapter 15 as a pdf-excerpt here:
http://www.inf.puc-rio.br/~roberto/pil2/chapter15.pdf

Here's the relevant part: 

  If require cannot find a Lua file compatible with the module name, it
  looks for a C library. For this search, it gets the path from variable
  package.cpath (instead of package.path). This variable gets its
  initial value from the environment variable LUA_CPATH (instead of
  LUA_PATH). A typical value for this variable in Unix is like this:
  
    ./?.so;/usr/local/lib/lua/5.1/?.so
  
  Note that the file extension is defined by the path (e.g., the
  previous example uses .so for all templates). In Windows, a typical
  path is more like this one:
  
    .\?.dll;C:\Program Files\Lua501\dll\?.dll

Ciao
-- 
 Frank Barknecht                                     _ ______footils.org__




More information about the Pd-list mailing list