On Thu, Aug 25, 2016 at 5:49 PM, Henri Menke <henrime...@gmail.com> wrote: > Hi Kumar, > > the function job.variables.save seems to save the key in > job.variables.collected.macros instead of job.variables.collected. The > problem is that macros is not created unconditionally, which is why you might > run into a »attempt to index a nil value« error without some manual error > checking. Therefore I recommend assigning the temp value to > job.variables.tobesaved["document:temp:"..name]. Perhaps Hans joins this > discussion and schools me about why this could be a bad idea, but so far it > works. > > Also, I'd recommend making all your user level macros protected and check for > the optional argument in \startwhatever (otherwise you'll get errors like > »Macro doesn't match its definition«). Because I'm really cautious I also > use \luaescapestring{#1} (Try for example »foo"bar« as a value without).
<snipped code> Indeed, this worked! I'll try to understand the internals myself to know what is going on exactly. Thanks for the solution. Kumar ___________________________________________________________________________________ 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 ___________________________________________________________________________________