lua-users home
lua-l archive

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



> From: John Paquin [mailto:jpaquin@breakawaygames.com]
> Sent: Monday, December 15, 2003 12:53 PM
> To: Lua list
> Subject: RE: Recognizing Methods vs. Functions
> 
> >> But you have to know what arguments a
> >>  function takes in order to call it anyway
> yeah, but...
> I'm trying to look at the functions in a table and "sort" them into
two
> groups.  One that takes the self argument, and one that doesn't
(assume
> that
> I have a valid reason for doing this).  I need to make the
distinction,
> and
> I'd like to be able to do it automatically instead of using some hack
> naming
> convention to tell the difference.
> Thanks

Well in that case it may be a design problem? So this a little like
having static and non-static functions mixed in a class in C++? If this
is the case I'd declare them in 2 separate tables. Otherwise you could
try declaring all the functions with explicit self, i.e.

	function mod.foo(self, arg1, arg2) ... end

and always call with the ':' convention, ignoring self where you don't
need it.

Nick