Luvit works basically as you want, it has several modules embedded in the bundle (the standard library). Requires are relative to the file calling. So if you require from inside the bundle, it will only look in the bundle. But if you require from outside the bundle, it should look relative to that file first. You do need to bootstrap require on the outside like luvit does for loading files and loading the repl.
For loading scripts, it simply uses luvit/require to load the script. This will internally create a new require for use in the script that's relative to that script https://github.com/luvit/luvit/blob/master/main.lua#L114 In the repl, I create a custom require that loads relative to cwd when the repl was started. https://github.com/luvit/luvit/blob/master/deps/repl.lua#L31-L36 On Thu, Apr 16, 2015 at 9:10 AM, develephant <[email protected]> wrote: > Hello, > > I thought I read that *require* will check for locally sourced files > first, then the bundle attached. I don't seem to be having much luck with > this. The only way I can require an 'unbundled' file seems via the full > path. I have also tried the *deps* and *libs* folder without any > successful result. > > Now, I am using the Luvit *require* module via lit. I was looking > through that code, and it seems like it is ignoring anything except bundle > sources. Perhaps I am approaching it wrong, but what I am looking to do is: > > 1. Wrap some custom modules, and a handful of Luvit mods up with lit, > resulting in a Luvi executable. (done) > > 2. Have the client be able to create Lua files and place them in a > 'modules' folder (like classic Luvit) which I can require and access via > the main executable. Again, the idea is that if the file isn't in the > local 'modules' folder, then it checks the bundle. > > Hope this all makes sense. Any hints, tips, hacks, feedback, or > corrections welcome. > > The power of lit dawned on me while playing around with it last night. > It's really exciting, almost forgot to go to sleep. Great job. :) I don't > have any C experience to help with, but I will be doing some blog tutorials > eventually, and hopefully creating some public modules. > > There is also the coronium.gs code base folks can take a look at, though > that was written on classic Luvit. > > Best. > > > > > > > > > > > > > -- > You received this message because you are subscribed to the Google Groups > "luvit" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "luvit" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
