lua-users home
lua-l archive

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


> when i think of a multi-parameter `require`, i imagine it as a way to
> pass extra arguments to the required chunk

That would complicate the semantics of `require`, which loads modules
just once per session. Would a different set of extra arguments force
the module to be reloaded?

If you want to pass extra arguments to a module, just write your module as:

	private code
	return function (...)
		code to be run when required
	end

and use

	function xrequire(m,...)
		return require(m)(...)
	end