lua-users home
lua-l archive

Re: [proposal] require resources

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On 2020年01月20日 1:39 a.m., Sean Conner wrote:
It was thus said that the Great Soni They/Them L. once stated:
> > On 2020年01月20日 1:10 a.m., Sean Conner wrote:
> > It might seem like a simple request, but it's not.
> > The same can be said of require. > > Again it would just be replacing patterns: > > icon = require("org.conman.app.gopherclient","gopher.icon") > > replace the left's .'s with /'s, add / at the end, add right at the end. > > if you had resource path /usr/lib/lua/5.4/? for example, it would try to > open /usr/lib/lua/5.4/org/conman/app/gopherclient/gopher.icon
 Does it ever occur to you to actually *try* to implement your ideas?
 This idea, with a separate resource path, could be done in pure Lua. Add
a package.rpath (for resource path), then replace require() to look for two
parameters and handle it appropriately? I know I made a similar change
(adding a path, adding a new searcher function) to load C functions directly
from source [1]. And then hey, post the code and get feedback.
 -spc (Sigh)
[1]	https://github.com/spc476/lua-conmanorg/blob/master/lua/cc.lua
Many things could be done in pure-Lua.
Python has importlib.resources, and I think it's a neat idea to be able to handle resource packaging together with module packaging. It'd also be much cleaner if it was part of the language IMO. This is why it's a proposal and not an [ANN].
the whole proposal is "can we have this thing python has?" basically.

AltStyle によって変換されたページ (->オリジナル) /