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