[NTG-context] search path for require(...)

Ulrike Fischer news3 at nililand.de
Thu Mar 24 12:41:42 CET 2011


Am Thu, 24 Mar 2011 11:50:47 +0100 schrieb Philipp Gesang:


>>> (You’re going to have to declare the table “chessfss” globally
>>> for this to work.)
>> 
>> The chessfss.lua has a "return Table" at the end which declares the
>> table chessfss. 
>> 
>> To quote from http://lua-users.org/wiki/LuaModuleFunctionCritiqued:
>> 
>> "The problems above can be avoided by not using the module function
>> but instead defining modules in the following simple way: [*1][*2] 
> 
> Of course, that’s the Lua way. I can’t guess what you’re up to
> but if it’s going to eventually become a module, the “chessfss”
> 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 “require” altogether and just
> conclude your module with a line like:
> 
>   thirddata = thirddata or { }
>   thirddata.chessfss = chessfss
> 
> instead of returning a table, then loading it with “loadluafile”.
 
I'm not writing a module but virtual fonts, and they can be used
with context and latex. So whatever I will be doing should not be
context specific. But I will test if I can keep the chessfss-table
local, and if not put it in thirddata if it exists.


-- 
Ulrike Fischer 



More information about the ntg-context mailing list