On Thu, Mar 14, 2019 at 5:56 AM Henri Menke <henrimenke@gmail.com> wrote:

Dear list,

Something has changed in MetaFun and it can no longer be used in plain LuaTeX,
with neither of

    luatex test.tex
    mtxrun --script plain test.tex

This is the error:

    >> LUATEXFUNCTIONALITY
    >> "mp.print(LUATEXFUNCTIONALITY)"
    ! Equation cannot be performed (numeric=string).

MWE is below, as always.

Cheers, Henri

---

\directlua{
local mpkpse = kpse.new(arg[0], "mpost")

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

local mpx = mplib.new {
    find_file = finder
}
local ret = mpx:execute[[
boolean mplib ; mplib := true ;
input metafun.mp ;
]]

print(ret.log)
}
\bye


in mp-mlib.mpiv it seems that we should have 
string  LUATEXFUNCTIONALITY ; LUATEXFUNCTIONALITY := runscript("mp.print(LUATEXFUNCTIONALITY)") ;
instead of
numeric LUATEXFUNCTIONALITY ; LUATEXFUNCTIONALITY := runscript("mp.print(LUATEXFUNCTIONALITY)") ;
 
Now I have 
tex/texmf-context/metapost/context/base/mpiv$ grep -r LUATEXFUNCTIONALITY
mp-mlib.mpiv:%numeric LUATEXFUNCTIONALITY ; LUATEXFUNCTIONALITY := runscript("mp.print(LUATEXFUNCTIONALITY)") ;
mp-mlib.mpiv:string  LUATEXFUNCTIONALITY ; LUATEXFUNCTIONALITY := runscript("mp.print(LUATEXFUNCTIONALITY)") ;

and your example looks ok.

--
luigi