Hi (especially Jonathan), Taco Hoekwater wrote:
Jonathan Sauer wrote:
Hello,
BTW: loadstring can be passed a chunk name. Is it be possible to do the same with \directlua? (to replace "[string "luas[0]"]" above) Something like \directlua callback chunk {...} you mean? Yes. Maybe \directlua cname {My chunk name} {...} (since it is the name of the chunk, not specifically the name used in the callback/traceback).
This idea is very interesting. I have committed an experimental patch that extends \directlua syntax so that besides
\directlua <number> <general text>
it also allows a keyword prefix:
\directlua name <general text> <number> <general text>
This allows you to do stuff like this:
\directlua name {\jobname-\the\inputlineno} 0 {error('test')}
Because it is experimental, it only works for \directlua, not yet for \latelua.
I have just committed code that implements this same extension for \latexlua (#1300). Some small tests seem to indicate it works, but I have not been exhaustive so it would be nice if you could do some tests as well. That same commit also introduces a lua array named lua.instancename that allows lua.instancename[0] = "scratch" so that you can set a global default name for the lua instance. Explicit chunk names take precedence, of course. Best wishes, Taco