[luatex] Problem with mplib format in Lua script
Nicola
nvitacolonna at gmail.com
Sun Dec 20 12:06:34 CET 2009
Hi,
I've got stuck with the following problem: running a Lua script that
makes use of mplib (with the command 'luatex myscript.lua'). No TeX
involved. First I've tried:
local mplib = require('mplib')
local mp = mplib.new ({ ini_version = false })
if mp then
print "MPLib instantiated!"
else
print "MPLib not loaded :("
end
but mplib was not instantiated. Since I've installed mpost 1.208 and
mplib uses 1.207, I thought there was a format mismatch. So, I've tried
to generate a format file through mplib:
local mplib = require('mplib')
local mp = mplib.new ({ ini_version = true, mem_name = 'plain' })
if mp then
mp:execute('dump;')
mp:finish();
end
This has generated plain.mem in the current directory (but it's only
~13kb). But then:
local mplib = require('mplib')
local mp = mplib.new ({ ini_version = false, mem_name = 'plain' })
if mp then
local l = mp:execute([[
addto currentpicture doublepath (0,0)--(20,30);
shipout currentpicture;
]])
if l and l.status == 2 then
print(l.log)
end
mp:finish();
end
has resulted in the following output, as if the plain macros were not
loaded at all:
This is MetaPost, Version 1.207 (mem=plain 2009.12.20) 20 DEC 2009 11:51
>> (0
! Improper `addto'.
<to be read again>
,
<*> addto currentpicture doublepath (0,
0)--(20,30);
This expression should have specified a known path.
So I'll not change anything just now.
! Variable currentpicture is the wrong type (numeric).
<to be read again>
,
<*> addto currentpicture doublepath (0,
0)--(20,30);
I was looking for a "known" picture variable.
So I'll not change anything just now.
! Extra tokens will be flushed.
<to be read again>
,
<*> addto currentpicture doublepath (0,
0)--(20,30);
I've just read as much of that statement as I could fathom,
so a semicolon should have been next. It's very puzzling...
but I'll try to get myself back together, by ignoring
everything up to the next `;'. Please insert a semicolon
now in front of anything that you don't want me to delete.
(See Chapter 27 of The METAFONTbook for an example.)
>> currentpicture
! Not a known picture.
<to be read again>
;
<*> shipout currentpicture;
I can only output known pictures.
I'm using TeX Live 2009 on Intel Mac OS X, and luatex
beta-0.46.0-2009112820. Probably I am not dealing with file formats
correctly. Any hint?
Nicola
More information about the luatex
mailing list