|
On 21.10.2011 06:10, Sean Conner wrote:
[...] Code wanting to be a module would do: ----[ sample.lua ]--------- local string = _REQUIRE("string") _MODULE() function split(s,delim) ... end function wrap(s,margin) ... end function trim(s) ...end
You forgot 'return _ENV'! Since _MODULE does not get the module name, it cannot pass the exported definitions via 'package.loaded[ name ]'. So you must pass the exported definitions via 'return'.
If you add 'return _ENV', _MODULE() becomes '_ENV = {}'.
----[ end ]---------
Philipp