lua-users home
lua-l archive

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


Hello :-)

Sorry if the question has already been asked, but I could not
find any answer on the list so here it is :

Is there a way to detect if a function in a table should be called
as a "method" (OO style), e.g foo:bar() or if it has to be called
as a function - foo.bar() ?

Consider a XML-RPC server in Lua : exported functions and
"objects" in the global environment are available for clients. If
a client makes a request like this : "foo.bar", the server needs
to know how to execute the request.

Is there some debug library magic to be able to have a hint ?
I wonder, because for example if we know that the first
argument of function "bar" is "self", it probably indicates
that it should be called with ":" ... Well, even that is not a
good solution :-(

Help, anyone ?

Thanks in advance !
Matias.