lua-users home
lua-l archive

Re: How to query current path from a library?

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


> On a related note, is there any chance that Lua 5.2 will allow
> require() to take additional parameters that will be passed to the
> loaded chunk? That's the only reason I really need to use loadfile(),
> to pass my own parameters. require() already passes the module name
If write your Lua module like this:
	return function (...)
		...
	end
Then you can require this module as
	require("mymodule")(100,200,300)
If all your modules are like that, then you can redefine require as:
	do
		local old_require=require
		function require(name,...) return old_require(name)(...) end
	end

AltStyle によって変換されたページ (->オリジナル) /