Taco:
which just wraps every letter inside \dolua{ }. However, the letters are silently ignored (but "print" prints it in the console, so lua is working). I presume the problem is "tex.print" is like a line in the tex file, while ocp's are applied after expansion, so when \dolua is executed it's too late and the line is sent to nowhere.
That is roughly what happens, yes. I have to look into this at some point, because silently disappearing output is a bit unfriendly, but the precise interaction between otp processing and input states is not the easiest bit of TeX to comprehend, so it may take a while.
OK. What I was wondering was if the whole OCP mechanim could be replaced by lua scripts. Since lua can be embedded in TeX, the transformations would be under the control of TeX and not as external files, unmodifiable at run time. So, I intented to write a OTP passing directly the OCP buffer to lua. Of course, that has some disadvantages since the result may need further expansion to reprocess it. Or perhaps not? This is what I liked to investigate. Javier