lua-users home
lua-l archive

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


On Thu, Jun 22, 2000 at 04:45:01AM -0300, Mike Cuddy wrote:
> I'm defining an "object class" by using a table, Which is better "style" ...
> 
> Should I define the "member functions" inside the table declarations for
> the class, like this:
> 
>     FooClassTag = newtag();
>     FooClassInstanceTag = newtag();
>     FooClass = {
> 	instanceTag = FooClassInstanceTag,
> 	dataMember = defaultValue,
> 	-- etc.
> 
> 	-- "member functions"
> 	memberFunc = function (self, param)
> 	    -- stuff ...
> 	end
>     }

I do the above. I was very happy when anonymous function declaration
syntax was added for this very reason. I like that all the data and
functions for a class are "contained" in one place here.

-- 
David Jeske (N9LCA) + http://www.chat.net/~jeske/ + jeske@chat.net