lua-users home
lua-l archive

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


Suppose that you have the following overloaded function:

void f(int i);
void f(const char *s);

tolua follows the spirit of lua and attempts to convert a number to a
string if the types do not match. Unfortunately, this can break the
resolution of the overloading if tolua attempts to match the types for
f(const char *s) first.

To work around this problem, it is necessary to declare the functions
in the tolua *.pkg file in this order:

void f(const char *s);
void f(int i);

Or more generally, the functions need to be declared in reverse order
of the one in which they should be tried for overloading resolution.
Not exactly intuitive, but here we go. Thought I would pass this on.

- Christian