lua-users home
lua-l archive

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


Hi Steve Donovan,

Yes, what I want is **a module as a class**.

http://lua-users.org/wiki/TemplatePattern

I am studying this method.

And with your comment below, I think I can make what I want!!

You can create a module which returns a function (doesn't always have
to be a table!) which you call to create a new specialized 'instance'.
(classes are a subset of this idea)

Great! Thank you very much!! ^^;

I know the function which make specialized table from PIL.

Thank you!
Sincerely
Journeyer


----------------------------------------
Journeyer J. Joh
o o s a p r o g r a m m e r
a t
g m a i l  d o t  c o m
----------------------------------------


2014-03-06 16:14 GMT+09:00 steve donovan <steve.j.donovan@gmail.com>:
On Thu, Mar 6, 2014 at 8:58 AM, Journeyer J. Joh
<oosaprogrammer@gmail.com> > There is no way to make two instances of
a module.
>
> Am I right?

Completely right.  By design, modules are loaded exactly once, and cached.

What do you want to do?

You can create a module which returns a function (doesn't always have
to be a table!) which you call to create a new specialized 'instance'.

(classes are a subset of this idea)

steve d.