Re: [proposal] require resources
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: [proposal] require resources
- From: "Soni \"They/Them\" L." <fakedme@...>
- Date: 2020年1月19日 22:26:29 -0300
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
HOWEVER this would only apply to the default loaders. what I mean by
that is that one could make a zip file loader and then you can have your
whole module (and submodules) as a zip file instead.
foo.zip
| init.lua
| bar/init.lua
| bar/res.txt
which is a lot harder than opening a file in LUA_PATH.
On 2020年01月19日 9:37 p.m., Egor Skriptunoff wrote:
On Mon, Jan 20, 2020 at 3:25 AM Soni "They/Them" L. wrote:
require("foo.bar", "res.txt") would look for "res.txt" as a file in
module "foo.bar"
What value is expected to be returned by require("foo.bar", "res.txt")?
Why not using a function for the same task?
local res = require("foo.bar").get_resource()