From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/67329 Path: news.gmane.org!not-for-mail From: Philipp Gesang Newsgroups: gmane.comp.tex.context Subject: Re: search path for require(...) Date: Thu, 24 Mar 2011 11:50:47 +0100 Message-ID: <20110324105047.GE3626@orcus> References: <55a1sy0sjbc.dlg@nililand.de> <20110324101400.GC3626@orcus> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0551292604==" X-Trace: dough.gmane.org 1300963880 18508 80.91.229.12 (24 Mar 2011 10:51:20 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 24 Mar 2011 10:51:20 +0000 (UTC) To: news3@nililand.de, mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Thu Mar 24 11:51:15 2011 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from balder.ntg.nl ([195.12.62.10]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Q2i8J-0005t5-BH for gctc-ntg-context-518@m.gmane.org; Thu, 24 Mar 2011 11:51:15 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 26590CAB44; Thu, 24 Mar 2011 11:51:01 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id VeSsHD0TJLPV; Thu, 24 Mar 2011 11:50:58 +0100 (CET) Original-Received: from balder.ntg.nl (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id D486ECAB2F; Thu, 24 Mar 2011 11:50:57 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id E3D4DCAB2F for ; Thu, 24 Mar 2011 11:50:56 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id utxfSpwiGPkx for ; Thu, 24 Mar 2011 11:50:54 +0100 (CET) Original-Received: from filter4-nij.mf.surf.net (filter4-nij.mf.surf.net [195.169.124.155]) by balder.ntg.nl (Postfix) with ESMTP id D57BCCAAFF for ; Thu, 24 Mar 2011 11:50:54 +0100 (CET) Original-Received: from relay.uni-heidelberg.de (relay.uni-heidelberg.de [129.206.100.212]) by filter4-nij.mf.surf.net (8.14.3/8.14.3/Debian-5+lenny1) with ESMTP id p2OAp7ZT031479 for ; Thu, 24 Mar 2011 11:51:08 +0100 Original-Received: from ix.urz.uni-heidelberg.de (cyrus-portal.urz.uni-heidelberg.de [129.206.100.176]) by relay.uni-heidelberg.de (8.14.1/8.14.1) with ESMTP id p2OAoohk016881 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 24 Mar 2011 11:50:51 +0100 Original-Received: from extmail.urz.uni-heidelberg.de (extmail.urz.uni-heidelberg.de [129.206.100.140]) by ix.urz.uni-heidelberg.de (8.13.8/8.13.8) with ESMTP id p2OAooC9003048 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 24 Mar 2011 11:50:50 +0100 Original-Received: from localhost (dslb-188-104-153-096.pools.arcor-ip.net [188.104.153.96]) (authenticated bits=0) by extmail.urz.uni-heidelberg.de (8.13.4/8.13.1) with ESMTP id p2OAom97026478 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Thu, 24 Mar 2011 11:50:50 +0100 In-Reply-To: X-Operating-System: Linux orcus 2.6.37-ARCH User-Agent: Mutt/1.5.21 (2010-09-15) X-Bayes-Prob: 0.0174 (Score 0, tokens from: @@RPTN) X-CanIt-Geo: ip=129.206.100.212; country=DE; region=01; city=Heidelberg; latitude=49.4167; longitude=8.7000; http://maps.google.com/maps?q=49.4167,8.7000&z=6 X-CanItPRO-Stream: uu:ntg-context@ntg.nl (inherits from uu:default, base:default) X-Canit-Stats-ID: 04EmWP7kz - 554e4bc1b677 - 20110324 X-Scanned-By: CanIt (www . roaringpenguin . com) on 195.169.124.155 X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.12 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: ntg-context-bounces@ntg.nl Errors-To: ntg-context-bounces@ntg.nl Xref: news.gmane.org gmane.comp.tex.context:67329 Archived-At: --===============0551292604== Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="3xoW37o/FfUZJwQG" Content-Disposition: inline --3xoW37o/FfUZJwQG Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 2011-03-24 <11:34:21>, Ulrike Fischer wrote: > Am Thu, 24 Mar 2011 11:14:00 +0100 schrieb Philipp Gesang: >=20 > >> I'm trying to store the virtual lua chess fonts I'm currently > >> creating so that latex and context can use them.=20 > >>=20 > >> 1. At first I stored the vf-chess-XX.lua in tex/luatex. This works > >> for latex but not for context. tex/generic works for both.=20 > >>=20 > >> 2. My fonts loads a lua-file which should be shared by all fonts > >> with=20 > >>=20 > >> chessfss=3Drequire('chessfss') > >>=20 > >> latex finds the chessfss.lua without problems in various locations > >> (e.g. tex/generic) but context not. How can I solve this problem? > >=20 > > Hi Ulrike, > >=20 > > see also: > > http://www.ntg.nl/pipermail/ntg-context/2010/047721.html >=20 > Ah. chessfss =3D require('chessfss.lua') works in context. And it > seems to work with latex too (I had somewhere in the back of my mind > the thought that the ".lua" extension breaks with latex but can't > reproduce it currently).=20 >=20 >=20 > > (You=E2=80=99re going to have to declare the table =E2=80=9Cchessfss=E2= =80=9D globally > > for this to work.) >=20 > The chessfss.lua has a "return Table" at the end which declares the > table chessfss.=20 >=20 > To quote from http://lua-users.org/wiki/LuaModuleFunctionCritiqued: >=20 > "The problems above can be avoided by not using the module function > but instead defining modules in the following simple way: [*1][*2]=20 Of course, that=E2=80=99s the Lua way. I can=E2=80=99t guess what you=E2=80= =99re up to but if it=E2=80=99s going to eventually become a module, the =E2=80=9Cchess= fss=E2=80=9D table should not pollute the global namespace. There are canonical locations (check luat-ini.lua) where the functions and data should go: http://www.ntg.nl/pipermail/ntg-context/2010/054982.html So you might be better off dropping =E2=80=9Crequire=E2=80=9D altogether an= d just conclude your module with a line like: thirddata =3D thirddata or { } thirddata.chessfss =3D chessfss instead of returning a table, then loading it with =E2=80=9Cloadluafile=E2= =80=9D. Regards, Philipp >=20 > -- hello/world.lua > local M =3D {} >=20 > local function test(n) print(n) end > function M.test1() test(123) end > function M.test2() M.test1(); M.test1() end >=20 > return M >=20 > and importing modules this way:=20 >=20 > local MT =3D require "hello.world" > MT.test2()" >=20 >=20 > --=20 > Ulrike Fischer=20 >=20 > _________________________________________________________________________= __________ > If your question is of interest to others as well, please add an entry to= the Wiki! >=20 > maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-co= ntext > webpage : http://www.pragma-ade.nl / http://tex.aanhet.net > archive : http://foundry.supelec.fr/projects/contextrev/ > wiki : http://contextgarden.net > _________________________________________________________________________= __________ --3xoW37o/FfUZJwQG Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) iEYEARECAAYFAk2LIgcACgkQ02lYlJYWs9L6lgCaAhNP+/pchJ/4ypP+Akl+Oau9 8VUAn15P0ZTU1/8Icz1r29cG5EeVR/L+ =kOOa -----END PGP SIGNATURE----- --3xoW37o/FfUZJwQG-- --===============0551292604== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________ --===============0551292604==--