lua-users home
lua-l archive

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


I have been struggling with the "multiload" exercise in chapter 16
of Programming in Lua. I managed to cook up a "loadwithprefix"
that worked satisfactorily but when I extended it in the obvious
way with a postfix as well I got "file already closed" errors.
The io.lines iterator must have changed for Lua 5.4 to keep
track of when the file is to-be-closed, and so presumably an
extra upvalue of the iterator function is being used for this.
But I am getting a headache trying to work out from liolib.c
exactly what is going on. Can any kind expert give me some hints?
--
Gavin Wraith (gavin@wra1th.plus.com)
Home page: http://www.wra1th.plus.com/