filecache.lua

Sun, 06 Sep 2020 22:12:52 +0300

author
Tuomo Valkonen <tuomov@iki.fi>
date
Sun, 06 Sep 2020 22:12:52 +0300
changeset 35
2f927eae429b
parent 7
038275cd92ed
permissions
-rw-r--r--

Don't auto-create directories that will be empty


--@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