DOI: 10.5300/2017-3-4/138

Zpravodaj Československého sdružení uživatelů TEXu 3-4/2017

Pages: 138–154

Author: Hans Hagen

Lua in MetaPost

Already for a some years I have been wondering how it would be if we could escape to Lua inside MetaPost, or in practice, in MPlib in LuaTEX. The idea is simple: embed Lua code in a MetaPost file that gets run as soon as it's seen. In case you wonder why Lua code makes sense, imagine generating graphics using external data. The capabilities of Lua to deal with that is more flexible and advanced than in MetaPost. Of course we could generate a MetaPost definition of a graphic from data but often it makes more sense to do the reverse. I finally found time and reason to look into this and in the following sections I will describe how it's done.

Lua, LuaTEX, ConTEXt, MetaPost, MPLib

Lua v MetaPostu

V LuaTEXu lze nyní spouštět skripty v jazyce Lua z interpretru jazyka Me- taPost. Článek na příkladech popisuje samotný mechanismus, nízkoúrovňové rozhraní na úrovni LuaTEXu i vysokoúrovňové rozhraní pro formát ConTEXt.

Lua, LuaTEX, ConTEXt, MetaPost, MPLib


Hlavní stránka Zpravodaje CSTUGu. Adresa redakce: zpravodaj@cstug.cz. (c) 1996-2012 CSTUG