(Sorry about the two emails sent mistakenly from my address @ens.fr, Taco. I'm still in the process of migrating between two servers).
whow, so what do you expect from this:
You mean, without cheating? I can try and guess.
\directlua0{tex.sprint(string.reverse("Hello World!"))}
I supposed the string is reversed by Lua, and then handed over to TeX to print, so you see it printed backward.
\beginR\directlua0{tex.sprint(string.reverse("Hello World!"))}\endR
Here the string will probably be reversed by Lua as above, and then reversed again by the e-TeX primitive, so you will see it in the right order, though I don't know what happens with the more refined metrics like kerning or ligatures when using \beginR; I guess the ligatures would be broken in a word like "difficult", because LuaTeX would see "tluciffid"... OK, that's a bad example. But unless \beginR does some fine-tuning, I expect the ligature to be broken. Arthur