Skip to content

class OpenReadFileEnv

LuaTeX never looks at the rest of the table, so you can use it to store your private per-file data. Both the callback functions will receive the table as their only argument.


methods


OpenReadFileEnv.reader


function OpenReadFileEnv.reader(env: OpenReadFileEnv {
    reader = function,
    close = function,
}) -> line string?

Read a line from a file opened with the open_read_file callback. The argument is the return value from open_read_file

LuaTeX will run this function whenever it needs a new input line from the file.

Your function should return either a string or nil. The value nil signals that the end of file has occurred, and will make TeX call the optional

OpenReadFileEnv.close


function OpenReadFileEnv.close(env: OpenReadFileEnv {
    reader = function,
    close = function,
})

Close a file opened with the open_read_file callback. The argument is the return value from the open_read_file.

LuaTeX will run this optional function when it decides to close the file.