filecache.lua

changeset 7
038275cd92ed
parent 3
b2df1b3f2c83
equal deleted inserted replaced
6:219d7a7304f8 7:038275cd92ed
1 1
2 module("filecache", package.seeall) 2 --@module filecache
3
4 local filecache={}
3 5
4 local cache={} 6 local cache={}
5 7
6 function get(file) 8 function filecache.get(file)
7 if not cache[file] then 9 if not cache[file] then
8 local f=io.openX(file, "r") 10 local f=io.openX(file, "r")
9 cache[file]=f:read('*a') 11 cache[file]=f:read('*a')
10 f:close() 12 f:close()
11 end 13 end
12 return cache[file] 14 return cache[file]
13 end 15 end
16
17 return filecache

mercurial