[metapost] No log neither heigh of the fig (mplib)

Maxime Chupin notezik at gmail.com
Mon Jul 8 11:41:41 CEST 2019


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 : chupin at fougeriens.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://tug.org/pipermail/metapost/attachments/20190708/e86db97f/attachment.html>


More information about the metapost mailing list