filecache.lua

Tue, 16 Jan 2018 16:39:48 +0000

author
Tuomo Valkonen <tuomov@iki.fi>
date
Tue, 16 Jan 2018 16:39:48 +0000
changeset 7
038275cd92ed
parent 3
b2df1b3f2c83
permissions
-rw-r--r--

Convert module stuff to lua 5.3


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