lua-users home
lua-l archive

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


Hi to all.

How would you manage the following scenario:

You have a module, which exports a public interface, and has private
bits. Say:

---------------------------------
local M={}
local aux = function(n) 
	return "I say "..n
end
M.exclamate = function(s) 
	return aux(s).."!"
end
return M
---------------------------------

Now, you module get's so complex that you want to split in several
submodules. Those submodules want to have access to the private bits
also, and add functionality to the module in the form of more calls
available (without polluting the module table with all the private bits,
obviously). 
For example, in another file I want to define the function

---------------------------------
M.wonder = function(s)     --M from above
	return aux(s).."?" --aux from above
end
---------------------------------

How would that be done?

Thanks,

Jorge