Is there any documentation on how to write to a custom defined output-stream? I couldn't find any help on how to set up an output stream defined in tex and used in lua, i.e \newwrite\xmlfile \immediate\openout\xmlfile=test.xml \immediate\write\xmlfile{<?xml version="1.0"?>} \directlua{ tex.print(... ??? } Thanks for your help, Frank