No log neither heigh of the fig (mplib)

Maxime Chupin <[email protected]> Mon, 8 Jul 2019 11:41:41 +0200
Newsgroups gmane.comp.tex.metapost
Message-ID <CAJPNWxCnptVKU0yAoF+WhuN4S=kQdWTFd1TxWAhjps2nVe_JPg@mail.gmail.com>
Hi,
I do not understand why the following code does not produce a log and a
height (or width) for the fig. Any help to find out what I do not do right?

Thanks in advance

Maxime Chupin

local mpkpse = kpse.new('luatex', 'mpost')

local function finder(name, mode, ftype)
   if mode == "w" then
  return name
   else
  return mpkpse:find_file(name,ftype)
   end
end


function getpathfrommp(s)
   local mp = mplib.new({
         find_file = finder,})
   mp:execute('input plain ;')
   local rettable
   rettable = mp:execute('beginfig(1); draw (0,0)--(2cm,2cm); endfig;')
   print("\nstatus: ".. rettable.status)
   print(rettable.log)
   if rettable.status == 0 then
      print("height: "..rettable.fig[1]:height())
   end
end

getpathfrommp()


-- 
Maxime Chupin
Site personnel : http://fougeriens.org/~mc/
Site professionnel : https://www.ceremade.dauphine.fr/~chupin/
<http://www.ceremade.dauphine.fr/~chupin/>
adresse libre : [email protected]

--
http://tug.org/metapost/