On Wed, Sep 12, 2018 at 1:51 PM luigi scarso <luigi.scarso@gmail.com> wrote:


On Wed, Sep 12, 2018 at 1:38 PM Marcel Krüger <tex@2krueger.de> wrote:
 ---- On Wed, 12 Sep 2018 13:07:36 +0200 luigi scarso <luigi.scarso@gmail.com> wrote ----
 >
 >
 > On Wed, Sep 12, 2018 at 12:16 PM Marcel Krüger <tex@2krueger.de> wrote:
 > Hi,
 > 
 >  I noticed two problems with the mplib `get_...` family of functions:
 > 
 >  - First there seems to be a LuaTeX specific documentation bug:
 >    In the LuaTeX manual these functions are listed as `getboolean`,
 >    `getnumeric`, `getstring`and `getpath`, but in the actual
 >    implementation the names contain a underscore.
 > 
 >  - If `get_numeric` is called while two nested loops are in effect in MetaPost,
 >    an endless loop is triggered when MetaPost tries to iterate
 >    through the current loops.
 > 
 >  I attached a patch fixing both problems. The second point also applies to the standalone mplib.
 >
 > Thank you for the patches.Do you have an example where the get_numeric fails ? --

A plain LuaTeX example:

    \directlua{
      local mp
      mp = mplib.new{
        extensions = 1,
        run_script = function(script)
          print('The value:', mp:get_numeric'mynumeric')
          return ""
        end
      }
      mp:execute[[
        mynumeric = 1;
        myother = for i=1,2:
                    for j=1,2:
                        i+j+runscript"something"
                  endfor endfor
                  1;
      ]]
    }
    \bye

This prints `The value:    1.0` with the patch and freezes without it.

Best regards
Marcel

OK, thank you very much. 


--
luigi

patched applied --  revision 6978.
--
luigi