Positive07 wrote:Why would it be better... it does the same and doesnt look more readable... is there any benefit?
Well it does not really do the same on a machine level, but let's face it - mass requiring of files is hardly something that needs to be optimized.
(If you're interested what happens below, I recommend using the command "luac -l" on a file containing the function. This can be very helpful if you need to optimize hard loops as well )
But as Robin already said, it's just for fun. And I think it's a quite cool way to describe that function.
(And it reminds us that there is the select function which can be quite useful at times)
I couldn't resist to change it a bit though^^
Code: Select all
local function requirei(d, ...)
if ... then
return require(d .. ...), requirei(d, select(2, ...))