lua-users home
lua-l archive

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


> You can avoid the setconstructor callback since _M can be accessed
> from the environment after calling module().


True!

I used to do

local getfenv = getfenv

module('myobject')

local C = {}
local M = setmetatable(getfenv(), C)

but I for whatever reason decided on the setconstructor method and
have stuck with it.  Once the decision was made, I wanted to be
consistent and have stuck with it.

wes