filecache.lua

Wed, 15 Dec 2021 10:37:47 +0200

author
Tuomo Valkonen <tuomov@iki.fi>
date
Wed, 15 Dec 2021 10:37:47 +0200
changeset 41
8040d3a298e4
parent 7
038275cd92ed
permissions
-rw-r--r--

Add ANTI-ABUSE LICENSE


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