Meer, Hans van der
24. Januar 2016 um 15:58
Yes this works. But alas, the ultimate goal is to test against several characters and that seems impossible to do with standard ConTeXt api-macros.Let alone when these characters are . or . or ) etc.
\startluacode

function checknextstring(str)
    if str == "a" then
        context("A")
    elseif str == "b" then
        context("B")
    else
        context("??")
    end
end

interfaces.implement { name = "readnextstring", actions = checknextstring,   arguments = "string" }

\stopluacode

\unprotect
\let\readnextstring\clf_readnextstring
\protect

\starttext

\readnextstring c
\readnextstring b
\readnextstring a
\readnextstring {xx}

\stoptext

Wolfgang