[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: lua modules and OO
- From: Wesley Smith <wesley.hoke@...>
- Date: Fri, 24 Jul 2009 17:46:12 -0700
> 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