[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Modules, interfaces
- From: Rebel Neurofog <rebelneurofog@...>
- Date: Tue, 10 Apr 2012 19:28:57 +0400
> local m, private=require "m"
It isn't too clean way. Consider following:
local module_list = {
require ("m"),
require ("n"),
require ("q"),
}
print (#module_list) -- The printed value will be "4"
If I'd have a goal to return garbage-free table (for iteration),
I'd try to add some meta-method like:
local m =require "m"
m^"private"
BTW, I personally use metamethod "call" for object construction very
often. E. g.:
local a = mesh () -- instead of or in addition to mesh.new ()