lua-users home
lua-l archive

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


Yeah, that makes sense. I never tried passing any other types of references other than strings, but they're const and that makes it clear that I'm not using them as return values.

I just tested now with int& and indeed tolua is pushing it in the stack, even if declared as const.
So I guess it's most certainly a bug in the tool...

On 10/6/06, Sam Roberts <sroberts@bycast.com> wrote:
On Fri, Oct 06, 2006 at 02:21:24PM -0300, Frederico Ferro Schuh wrote:
>     void doStuff(const std::string& p1, int p2, const std::string& p3,
> const char* p4);
>  };

>  // the actual method call
>  self->doStuff(p1,p2,p3,p4);
>  tolua_pushcppstring(tolua_S,(const char*)p1);
>  tolua_pushcppstring(tolua_S,(const char*)p3);

I know nothing about tolua, but I would guess that since the std:string
arguments are called as references, they may actually be output
arguments, so they are pushed back to lua after the call.

Except that the reference arguments are const... so can't be return
values, so perhaps its a bug that the "const" isn't respected?

Cheers,
Sam




--
Frederico Ferro Schuh
ICQ 20486081
MSN fred.schuh@gmail.com