[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Convenience require
- From: "Soni L." <fakedme@...>
- Date: Sun, 12 Jun 2016 20:23:04 -0300
On 12/06/16 08:20 PM, Soni L. wrote:
We currently have raw requires, which means we do things like
local a = require"io.github.soniex2.a" local b =
require"io.github.soniex2.b" local c = require"io.github.soniex2.b.c"
-- use a, b and c normally
Instead of that, is there a module or something that lets me do
local soniex2 = reqpath"io.github.soniex2" local a = soniex2("a") --
alternatively, `soniex2.a()` local b = soniex2("b") -- alternatively,
`soniex2.b()` local c = soniex2("b.c") -- alternatively,
`soniex2.b.c()`, with the call at the -- end for disambiguating
between module and path, and -- setting an __index is not an option as
the module -- could already have its own __index (or not be a -- table
at all; some modules return functions!). -- use a, b and c normally
I think it looks nicer.
Ugh, why did my email client fuck that up so badly :/ Let me re-send...
Disclaimer: these emails may be made public at any given time, with or without reason. If you don't agree with this, DO NOT REPLY.