[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Modules, interafaces
- From: Jorge <xxopxe@...>
- Date: Tue, 10 Apr 2012 11:02:02 -0300
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