filecache.lua

Fri, 24 Jan 2025 13:27:45 +0100

author
Tuomo Valkonen <tuomov@iki.fi>
date
Fri, 24 Jan 2025 13:27:45 +0100
changeset 44
5700ebe9277b
parent 7
038275cd92ed
permissions
-rw-r--r--

Fix directory creation, as lfs doesn't do all leaves like the old approach.


--@module filecache

local filecache={}

local cache={}

function filecache.get(file)
    if not cache[file] then
        local f=io.openX(file, "r")
        cache[file]=f:read('*a')
        f:close()
    end
    return cache[file]
end

return filecache

mercurial