problem with binding operator

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

problem with binding operator

martin nilsen
Just starting Luabinding and run into some problems with () operators,
havent read anything about luabind not supporting those.
struct Str8 // Text String (8-bit per character)
{
   // get
           operator CChar8*()C {return _d.data();} // cast to CChar8*
   CChar8* operator()(      )C {return _d.data();} // get  text data


void LuaString8(lua_State *L)
{
     module(L)
     [
         luabind::class_<Str8>("Str8")
         .def(CChar8*())


error C2059: syntax error : ')'



--
Later

------------------------------------------------------------------------------
Colocation vs. Managed Hosting
A question and answer guide to determining the best fit
for your organization - today and in the future.
http://p.sf.net/sfu/internap-sfd2d
_______________________________________________
luabind-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/luabind-user
Reply | Threaded
Open this post in threaded view
|

Re: problem with binding operator

DA SILVA Antonio

Hi

I think you have to write something like:


void LuaString8(lua_State *L)
{
     module(L)
     [
         luabind::class_<Str8>("Str8")
         .def( "toCChar8", ( CChar8*( Str8::* )( ) )&Str8::operator( ) )


and then into LUA you call "myStr8.toCChar8( )"



Le 18/03/2011 05:54, martin nilsen a écrit :

> Just starting Luabinding and run into some problems with () operators,
> havent read anything about luabind not supporting those.
> struct Str8 // Text String (8-bit per character)
> {
>    // get
>            operator CChar8*()C {return _d.data();} // cast to CChar8*
>    CChar8* operator()(      )C {return _d.data();} // get  text data
>
>
> void LuaString8(lua_State *L)
> {
>      module(L)
>      [
>          luabind::class_<Str8>("Str8")
>          .def(CChar8*())
>
>
> error C2059: syntax error : ')'
>
>
>

------------------------------------------------------------------------------
Colocation vs. Managed Hosting
A question and answer guide to determining the best fit
for your organization - today and in the future.
http://p.sf.net/sfu/internap-sfd2d
_______________________________________________
luabind-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/luabind-user
Reply | Threaded
Open this post in threaded view
|

Re: problem with binding operator

martin nilsen
Seems like

myStr8

was enough to pass it as a char atleast, but my logger recieves no
chars, only that it should execute.
eg the logline returned = ""

Also I entered anouter post regarding possibility to make luabind map
this for me?
Because
both Str8 and Str supports constructors with cchar8* but when trying
to add it to

logger(C Str&)

in lua
logger(mystr8) //returns no text but adds a empty line even though the
mystr8 is not empty
logger(mystr8./:toCChar8) // crash non usable command
logger('this will crash') // crashes for some reason

On Fri, Mar 18, 2011 at 9:33 AM, DA SILVA Antonio <[hidden email]> wrote:

>
> Hi
>
> I think you have to write something like:
>
>
> void LuaString8(lua_State *L)
> {
>     module(L)
>     [
>         luabind::class_<Str8>("Str8")
>         .def( "toCChar8", ( CChar8*( Str8::* )( ) )&Str8::operator( ) )
>
>
> and then into LUA you call "myStr8.toCChar8( )"
>
>
>
> Le 18/03/2011 05:54, martin nilsen a écrit :
>> Just starting Luabinding and run into some problems with () operators,
>> havent read anything about luabind not supporting those.
>> struct Str8 // Text String (8-bit per character)
>> {
>>    // get
>>            operator CChar8*()C {return _d.data();} // cast to CChar8*
>>    CChar8* operator()(      )C {return _d.data();} // get  text data
>>
>>
>> void LuaString8(lua_State *L)
>> {
>>      module(L)
>>      [
>>          luabind::class_<Str8>("Str8")
>>          .def(CChar8*())
>>
>>
>> error C2059: syntax error : ')'
>>
>>
>>
>
> ------------------------------------------------------------------------------
> Colocation vs. Managed Hosting
> A question and answer guide to determining the best fit
> for your organization - today and in the future.
> http://p.sf.net/sfu/internap-sfd2d
> _______________________________________________
> luabind-user mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/luabind-user
>



--
Later

------------------------------------------------------------------------------
Colocation vs. Managed Hosting
A question and answer guide to determining the best fit
for your organization - today and in the future.
http://p.sf.net/sfu/internap-sfd2d
_______________________________________________
luabind-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/luabind-user