lua-users home
lua-l archive

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

> 1. tolua is having problems parsing stuff like -
> enum Choice {
>         ch1 = 0,
>         ch2 = 1
> };
> If I have an enum declared inside a class it has a
> problems as well.

sorry! tolua is only parsing C-like enumeration.
enum {
      ch1 = 0,
      ch2 = 0

I will fix it.

> 2. I have a class with 2 overloaded member functions which have
> the same name but take different arguments - one takes
> an int and another const char *.
> class A {
>     A();
>     ~A();
>     void f1(int i);
>     void f1(const char *s);
> };
> If I run the following script the second f1 is getting called where
> as the first one should be called.
> local aobj = A:new()
> local i = 0
> aobj:f1(i)
> aobj:delete()

that's because, in general, lua converts a string into a number
and vice-versa. in some situations, it is the right choice, but
I agree that here we have a problem.

One simple solution would be to invert the order you declare the
function in the .pkg. As tolua tries the last one first,
it would call the int version when the argument is a number.

you are gonna have a similar problem if you call:


but, here, the string must be "numeric".

I will think about a fix.

thanks for reporting these problems.

-- waldemar