lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


> Datum: Sat, 27 Oct 2007 10:41:35 -0700
> Von: Bradley Smith <gmane@baysmith.com>
> An: lua@bazar2.conectiva.com.br
> Betreff: Re: Newbie module require problem

> Axel Etzold wrote:
> > Dear all,
> > 
> > some days ago, with expert help, I have been able to make
> > the lpeg library. The included test.lua script ran without problem.
> > But I can't require lpeg from another directory. This script:
> > 
> >> cat dois.lua
> > 
> > 
> > require("/usr/local/lpeg-0.7/lpeg")
> > 
> > local b= lpeg.R("09")^1
> > print(b)
> > 
> > gives me:
> > 
> > no field package.preload['/usr/local/lpeg-0.7/lpeg']
> > 
> > On the web, I searched for similar error messages, but there,
> > there was always a *.lua /*.luac file that needed some path
> > information for its retrieval. Now, in my directory /usr/local/lpeg-0.7/
> > I got this:
> > 
> > doc.html   lpeg-128.gif  lpeg.c  lpeg.so  makefile  re.lua  test.lua
> >  
> > Thank you for your help!
> > 
> > Best regards,
> > 
> > Axel 
> > 
> 
> Try replacing
> 
> require("/usr/local/lpeg-0.7/lpeg")
> 
> with
> 
> package.cpath = "/usr/local/lpeg-0.7/?.so;" .. package.cpath
> require("lpeg")
> 

Thank you, Bradley. This worked! 

Best regards,

Axel
-- 
Psssst! Schon vom neuen GMX MultiMessenger gehört?
Der kann`s mit allen: http://www.gmx.net/de/go/multimessenger