On Mon, Jan 20, 2020 at 4:26 AM Soni "They/Them" L. wrote:
If you had:
LUA_PATH/foo/init.lua
LUA_PATH/foo/bar/init.lua
LUA_PATH/foo/bar/res.txt
then require("foo.bar", "res.txt") would get you the contents of
LUA_PATH/foo/bar/res.txt
Should require() cache resources the same way as modules?
Would it be possible to have a module containing only resources without any code?
Could main program have its own resources (files from the same directory)?
require(nil, "res.txt")
Resources might be large enough, so it would be better to return a pseudo-file object
instead of huge Lua string.
local res = open_resource("foo.bar", "res.txt")
local data = "">
res:close()