lua-users home
lua-l archive

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


> 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 ()