Hi all, I noticed that although mtxrun preloads some of the context libs that doesn’t cover everything available during an ordinary mkiv run. What would be the canonical way to load additional libs like “luat-ini” &c. on demand? “environment.loadluafile()”? Can this be configured globally? Is it wise to mess with “own.libs” in mtxrun? Example: This snippet checks the global env for some tables. “mtxrun --script” doesn’t find any while some of them are there when processed as cld. ···8<···························································· -- http://www.ntg.nl/pipermail/ntg-context/2010/054982.html local testme = { "userdata", "thirddata", "moduledata", "documentdata", "parametersets", --"document" } for _,item in next, testme do local i = _G[item] if i then print(item, table.serialize(i)) else print(item, "Nope!") end end -- Comprehensive: --for _,k in next,table.sortedkeys(_G) do --print(k,_G[k]) --end ···8<···························································· (My issue is that I’m testing the lua internals of module code without having to startup the whole big typesetting environment. Would be much easier if everything normally accessible from inside an mkiv session was there as well.) Thanks for any insights, Philipp
On 16-2-2011 11:44, Philipp Gesang wrote:
Hi all,
I noticed that although mtxrun preloads some of the context libs that doesn’t cover everything available during an ordinary mkiv run. What would be the canonical way to load additional libs like “luat-ini”&c. on demand? “environment.loadluafile()”? Can this be configured globally? Is it wise to mess with “own.libs” in mtxrun?
Example: This snippet checks the global env for some tables. “mtxrun --script” doesn’t find any while some of them are there when processed as cld.
something dofile(resolvers.findfile("yourfile.lua")) but keep in mind that most of the mkiv code depends on other code and often they depend on functionality that is only available when we're in luatex mode and not in texlua mode Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
On 2011-02-16 <23:59:15>, Hans Hagen wrote:
On 16-2-2011 11:44, Philipp Gesang wrote:
Hi all,
I noticed that although mtxrun preloads some of the context libs that doesn’t cover everything available during an ordinary mkiv run. What would be the canonical way to load additional libs like “luat-ini”&c. on demand? “environment.loadluafile()”? Can this be configured globally? Is it wise to mess with “own.libs” in mtxrun?
Example: This snippet checks the global env for some tables. “mtxrun --script” doesn’t find any while some of them are there when processed as cld.
something
dofile(resolvers.findfile("yourfile.lua"))
but keep in mind that most of the mkiv code depends on other code and often they depend on functionality that is only available when we're in luatex mode and not in texlua mode
In this case there were two deps. I extracted the order in which the libs are loaded by context and put it on the wiki. This isn’t a *real* dependency tree but still it can be of help when troubleshooting similar issues. http://wiki.contextgarden.net/Running_Lua_Code_Externally#Standard_library_l... Thanks for the pointer, Philipp -- () ascii ribbon campaign - against html e-mail /\ www.asciiribbon.org - against proprietary attachments
participants (2)
-
Hans Hagen
-
Philipp Gesang