lua-users home
lua-l archive

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

Yes, I could, but image there are 30 or 40 of these functions.  The
constructor would get rather long.  The real goal here is to pass in
functions that describe behaviors to the constructor.  Sometimes,
these behavior functions need data from the constructor itself.  I
guess I could reorganize my constructor to take a table instead of a
list of values and pass the table into the function instead.  That
way, I can write a small constructor and general functions outside of


On 5/31/07, Roberto Ierusalimschy <> wrote:
> What I'd like is f1's val upvalue to refer to constructor's local
> variable val.  Is this possible somehow through environments?

Can't you define 'gen1' inside the constructor?

-- Roberto