[luatex] [lltx] new(missing) feature for luamplib for LuaLaTeX
Keith J. Schultz
schultzk at gmx.net
Wed Aug 8 22:36:03 CEST 2012
Hi Luigi,
loadstring is needed, but it is not enough.
loadstring only load the chunk, it does not need it. A
As a matter of fact I use: lines = assert(loadstring("return " .. theluafunction)
From inside the Tex side of LuaLaTeX the addline-function is call
and it concats the string to string that is proccesed later.
What I have done is taken this string, get the extract the the string that is
between dolua( and ), then use the above line.
Actually, no biggy. I am wandering why Manuel, the packagemaintain,
had not thought of this.
I wanted to depict some data I had on the Lua-side with MetaPost.
But, could not use \directlua inside of the mplibcode-environment.
I was forced to push everything back to TeX via tex.write.
I thought it would be better to call you from inside of the mplibcode environment.
Curious, what Manuel has to say.
regards
Keith
Am 08.08.2012 um 17:53 schrieb luigi scarso <luigi.scarso at gmail.com>:
>
>
> On Wed, Aug 8, 2012 at 5:43 PM, Keith J. Schultz <schultzk at uni-trier.de> wrote:
> Hi Manuel, All,
>
> I find that the mplibcode environment in LuaLaTeX is missing
> an important feature. There is no way to call Lua from inside it!
>
> I have investigated the code and found that the use of the verbatim-
> environment is preventing this. But, there is a way to install a Lua-calling
> mechanism.
>
> In the Lua-code of of luamplib. the function addline needs to be patched to
> catch a dolua-command, extract the Lua-function, call it and finally feed the result
> in the normal way to mplib.
>
> I have done that!
>
> Is there an interest for such a feature.? What kind of syntax would be preferred?
>
> It would be possible to write:
>
> \begin{mplibcode}
> . . .
>
> dolua(generatesomecommands(with, and, that))
>
> . . .
> \end{mplibcode}
>
> regards
> Keith
>
>
> isn't loadstring(s [,name]) enough ?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://tug.org/pipermail/luatex/attachments/20120808/a487bdc1/attachment.html>
More information about the luatex
mailing list