[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: require() multiple parameters
- From: steve donovan <steve.j.donovan@...>
- Date: Fri, 28 Sep 2012 09:36:15 +0200
On Fri, Sep 28, 2012 at 7:08 AM, Rena <hyperhacker@gmail.com> wrote:
> require("bread", "butter", "jelly")
It's not a difficult function to write:
function nrequire(...)
local args = {...}
for i,mod in ipairs(args) do
args[i] = require(mod)
end
return unpack(args)
end
And its module could be organized so that you could say:
local bread,butter,jelly = require 'multi' ('bread','butter','jelly')
(Yes, require() _can_ return multiple values but that's rather unusual)
steve d.