[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: a "feature" of tolua4.0a
- From: Waldemar Celes <celes@...>
- Date: Fri, 11 May 2001 13:29:42 -0300
Juan Pablo Sousa wrote:
> I don't know if you are already aware of this problem:
> when I have to overloaded functions that has some optional parameters tolua
> soemtimes can't find the correct function to call if I don't provide all the
> parameters. for example:
>
> I have
>
> class my_class {
> void some_function(char *);
> void some_function(int x,int y,int w=80,int h=80);
>
> }
>
> tolua generates something like this for the second one:
>
> static ...... my_class_some_function01(lua_State *tolua_S)
> {
> if (
> !tolua_istype(tolua_S,2,LUA_TNUMBER,0) ||
> !tolua_istype(tolua_S,3,LUA_TNUMBER,0) ||
> !tolua_istype(tolua_S,4,LUA_TNUMBER,0) ||
> !tolua_istype(tolua_S,5,LUA_TNUMBER,0) )
> //call the second one
> else
> //call the first one
> }
that's not true. tolua generates two different lines:
!tolua_istype(tolua_S,4,LUA_TNUMBER,1) ||
!tolua_istype(tolua_S,5,LUA_TNUMBER,1) )
notice the forth parameter with value 1, meaning there's a
default value for them.
> but if I call
> some_function(10,10) it will try to execute the one with char * with an
> error
>
it should work fine.
check your code again, please, and
let me know if the problem persists.
-- w