[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: [Q] How to deterministically release lsf.dir resources?
- From: Leo Razoumov <slonik.az@...>
- Date: Thu, 25 Jun 2009 19:22:40 -0400
LuaFileSystem (lfs) provides a directory iterator factory lfs.dir that
creates an iterator that opens a given directory and each time it is
called it returns a next directory entry. So far so good. An open
directory will be closed when (A) all the entries were delivered or
(B) when GC collects the corresponding userdata (__gc is provided).
Unfortunately, I do not see how one can close the directory explicitly
from Lua short of hacking lfs.c. The directory related userdata is
well hidden inside an upvalue accessible only to dir_iter.
Am I missing something?