lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On 17 February 2017 at 17:14, Dirk Laurie <dirk.laurie@gmail.com> wrote:
> Before rolling my own: is there a module on luarocks that makes a string
> look like a text file?
>
> I.e. supporting methods like "lines", "read" and "seek"?

Use io.tmpfile. i.e.

local file = io.tmpfile()
assert(file:write("my string"))
assert(file:seek("set"))