return_stl_iterator acting as const?

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

return_stl_iterator acting as const?

John Smith-124
Greetings all,

I'm having a problem setting the value of a class contained within a std::vector from lua, I have the following code:

C++:
class ContainedObject
{
public:
    int value;
};

class ContainerObject
{
public:
    std::vector<ContainedObject> vec;
    int containervalue;
};


luabind::module(L)
[
    luabind::class<ContainedObject>("ContainedObject")
    .def(luabind::constructor<>())
    .def_readwrite("value", &ContainedObject::value),

    luabind::class_<ContainerObject>("ContainerObject")
    .def_readwrite("containervalue",    &ContainerObject::containervalue)
    .def_readwrite("vec",            &ContainerObject::vec, luabind::return_stl_iterator)
];

ContainerObject cont;
ContainedObject Obj;

Obj.value = 10;

cont.push_back(Obj);
cont.containervalue = 15;

luabind::call_function<void>(L, "LuaFunction", &cont);

std::cout << cont.containervalue << std::endl;
std::cout << cont.vec[0].value << std::endl;



Lua code:
function LuaFunction( cont )
    print (cont.containervalue)
    cont.containervalue = 30
    for things in cont.vec
    do
        print (things.value)
        things.vlaue = 5
    end
end


Which prints out:
15
10
30
10
So I am able to modify the containervalue of ContainerObject, but I am not able to modify the ContainedObject value.  Any thoughts here?  Is luabind making a copy of the vector as it passes it off?  If so is there a by reference way possible?

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
luabind-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/luabind-user
Reply | Threaded
Open this post in threaded view
|

Re: return_stl_iterator acting as const?

Kristoffer Danielsson
If I remember correctly... use boost::ref() on the variables in your call to function_call:
 
function_call(boost::ref(myVar));
 

Date: Mon, 2 Mar 2009 01:09:27 -0800
From: [hidden email]
To: [hidden email]
Subject: [luabind] return_stl_iterator acting as const?

Greetings all,

I'm having a problem setting the value of a class contained within a std::vector from lua, I have the following code:

C++:
class ContainedObject
{
public:
    int value;
};

class ContainerObject
{
public:
    std::vector<ContainedObject> vec;
    int containervalue;
};


luabind::module(L)
[
    luabind::class<ContainedObject>("ContainedObject")
    .def(luabind::constructor<>())
    .def_readwrite("value", &ContainedObject::value),

    luabind::class_<ContainerObject>("ContainerObject")
    .def_readwrite("containervalue",    &ContainerObject::containervalue)
    .def_readwrite("vec",            &ContainerObject::vec, luabind::return_stl_iterator)
];

ContainerObject cont;
ContainedObject Obj;

Obj.value = 10;

cont.push_back(Obj);
cont.containervalue = 15;

luabind::call_function<void>(L, "LuaFunction", &cont);

std::cout << cont.containervalue << std::endl;
std::cout << cont.vec[0].value << std::endl;



Lua code:
function LuaFunction( cont )
    print (cont.containervalue)
    cont.containervalue = 30
    for things in cont.vec
    do
        print (things.value)
        things.vlaue = 5
    end
end


Which prints out:
15
10
30
10
So I am able to modify the containervalue of ContainerObject, but I am not able to modify the ContainedObject value.  Any thoughts here?  Is luabind making a copy of the vector as it passes it off?  If so is there a by reference way possible?


Hitta skönaste vinterresan här! MSN Resor
------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
luabind-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/luabind-user
Reply | Threaded
Open this post in threaded view
|

Re: return_stl_iterator acting as const?

John Smith-124
That didn't seem to do it.  To be clear from my example the class itself does appear to be acting as a ref, however the STL container contained WITHIN it seems to being copied to the lua object and *IT* isn't acting as a reference.

On Mon, Mar 2, 2009 at 2:04 PM, Kristoffer Danielsson <[hidden email]> wrote:
If I remember correctly... use boost::ref() on the variables in your call to function_call:
 
function_call(boost::ref(myVar));
 

Date: Mon, 2 Mar 2009 01:09:27 -0800
From: [hidden email]
To: [hidden email]
Subject: [luabind] return_stl_iterator acting as const?


Greetings all,

I'm having a problem setting the value of a class contained within a std::vector from lua, I have the following code:

C++:
class ContainedObject
{
public:
    int value;
};

class ContainerObject
{
public:
    std::vector<ContainedObject> vec;
    int containervalue;
};


luabind::module(L)
[
    luabind::class<ContainedObject>("ContainedObject")
    .def(luabind::constructor<>())
    .def_readwrite("value", &ContainedObject::value),

    luabind::class_<ContainerObject>("ContainerObject")
    .def_readwrite("containervalue",    &ContainerObject::containervalue)
    .def_readwrite("vec",            &ContainerObject::vec, luabind::return_stl_iterator)
];

ContainerObject cont;
ContainedObject Obj;

Obj.value = 10;

cont.push_back(Obj);
cont.containervalue = 15;

luabind::call_function<void>(L, "LuaFunction", &cont);

std::cout << cont.containervalue << std::endl;
std::cout << cont.vec[0].value << std::endl;



Lua code:
function LuaFunction( cont )
    print (cont.containervalue)
    cont.containervalue = 30
    for things in cont.vec
    do
        print (things.value)
        things.vlaue = 5
    end
end


Which prints out:
15
10
30
10
So I am able to modify the containervalue of ContainerObject, but I am not able to modify the ContainedObject value.  Any thoughts here?  Is luabind making a copy of the vector as it passes it off?  If so is there a by reference way possible?


Hitta skönaste vinterresan här! MSN Resor

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
luabind-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/luabind-user



------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
luabind-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/luabind-user
Reply | Threaded
Open this post in threaded view
|

Re: return_stl_iterator acting as const?

James Porter-2
In reply to this post by John Smith-124
John Smith wrote:

> Lua code:
> function LuaFunction( cont )
>     print (cont.containervalue)
>     cont.containervalue = 30
>     for things in cont.vec
>     do
>         print (things.value)
>         things.vlaue = 5
>     end
> end

It looks like you're using the wrong syntax for getting at your members.
In Lua, "." is similar to "::" in C++, while ":" in Lua is similar to
"." in C++. You want cont:containervalue, cont:vec, and so on. The
former is working because you're defining a new static variable,
essentially.

- Jim

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
luabind-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/luabind-user
Reply | Threaded
Open this post in threaded view
|

Re: return_stl_iterator acting as const?

John Smith-124
I don't believe so, changing that to be : gave the following errors:
print(cont:containervalue)
function arguments expected near ')' for that line

for things in cont:vec
gave the error:
 function arguments expected near 'do'

My understanding of the : notation was that it was a shorthand of:
x:y is equivilant to x.y(x)

Therefore, trying:
for things in cont:vec()

gave a luabind exception of 'No such operator defined'


On Tue, Mar 3, 2009 at 1:26 AM, James Porter <[hidden email]> wrote:
John Smith wrote:
> Lua code:
> function LuaFunction( cont )
>     print (cont.containervalue)
>     cont.containervalue = 30
>     for things in cont.vec
>     do
>         print (things.value)
>         things.vlaue = 5
>     end
> end

It looks like you're using the wrong syntax for getting at your members.
In Lua, "." is similar to "::" in C++, while ":" in Lua is similar to
"." in C++. You want cont:containervalue, cont:vec, and so on. The
former is working because you're defining a new static variable,
essentially.

- Jim

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
luabind-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/luabind-user


------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
luabind-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/luabind-user
Reply | Threaded
Open this post in threaded view
|

Re: return_stl_iterator acting as const?

John Smith-124
I hate replying to myself but I also noticed that this problem is only in the case where the vector is storing an object not a pointer to an object.  (Which is why I think I'm hitting a copy constructor at some point instead of having it pass by reference)

If I was to modify the container to be std::vector<ContainedObject *> vec;, and modify the test code to be:
ContainerObject cont;
ContainedObject* Obj = new ContainedObject;

Obj->value = 10;

cont.push_back(Obj);

Then when I come out of the call_function Obj has the expected value of 5. 

Anyone have other ideas/thoughts?

On Tue, Mar 3, 2009 at 1:57 AM, John Smith <[hidden email]> wrote:
I don't believe so, changing that to be : gave the following errors:
print(cont:containervalue)
function arguments expected near ')' for that line


for things in cont:vec
gave the error:
 function arguments expected near 'do'

My understanding of the : notation was that it was a shorthand of:
x:y is equivilant to x.y(x)

Therefore, trying:
for things in cont:vec()

gave a luabind exception of 'No such operator defined'



On Tue, Mar 3, 2009 at 1:26 AM, James Porter <[hidden email]> wrote:
John Smith wrote:
> Lua code:
> function LuaFunction( cont )
>     print (cont.containervalue)
>     cont.containervalue = 30
>     for things in cont.vec
>     do
>         print (things.value)
>         things.vlaue = 5
>     end
> end

It looks like you're using the wrong syntax for getting at your members.
In Lua, "." is similar to "::" in C++, while ":" in Lua is similar to
"." in C++. You want cont:containervalue, cont:vec, and so on. The
former is working because you're defining a new static variable,
essentially.

- Jim

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
luabind-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/luabind-user



------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
luabind-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/luabind-user
Reply | Threaded
Open this post in threaded view
|

unsigned byte color!

hymedia

Hello everyone,

 

Any particular reason why Luabind is choking on UChar?

 

.cpp

 

typedef unsigned char UChar;

 

class Color

{

      public:

 

            UChar r, g, b, a;

 

            inline Color(UChar in_r, UChar in_g, UChar in_b, UChar in_a):

                  r(in_r),

                  g(in_g),

                  b(in_b),

                  a(in_a) {}

 

                  ///SNIP...

}

 

Luabind

 

module(in_lua)

[

      class_<Color>("Color")

      .def(constructor<UChar, UChar, UChar, UChar>())

];

 

.lua

 

myColor = Color4i(255, 0, 0, 100);

 

result: No matching overload found

 

If I repalce every UChar by a float it does work… hummm… hocus pocus…

 


------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
luabind-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/luabind-user
Reply | Threaded
Open this post in threaded view
|

Re: unsigned byte color!

Tom McCubbin-2
Not to sound stupid, but why does your lua say:

myColor= Color4i(255, 0, 0, 100);

according to the luabind registration code, it should just be...

myColor=Color(255,0,0,100);

And lua internally supports plain ol' intergers ( int32 ...ok depends on platform but you get the point...)

so no matter what happens, this is likely going to be cast at runtime.  have a look at the c api for details as to the very minimal types supported w/in lua.




On Tue, 2009-03-03 at 12:36 -0500, hymedia wrote:
Hello everyone,

 

Any particular reason why Luabind is choking on UChar?

 

.cpp

 

typedef unsigned char UChar;

 

class Color

{

      public:

 

            UChar r, g, b, a;

 

            inline Color(UChar in_r, UChar in_g, UChar in_b, UChar in_a):

                  r(in_r),

                  g(in_g),

                  b(in_b),

                  a(in_a) {}

 

                  ///SNIP...

}

 

Luabind

 

module(in_lua)

[

      class_<Color>("Color")

      .def(constructor<UChar, UChar, UChar, UChar>())

];

 

.lua

 

myColor= Color4i(255, 0, 0, 100);

 

result: No matching overload found

 

If I repalce every UChar by a float it does work… hummm… hocus pocus…

 


------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________ luabind-user mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/luabind-user

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
luabind-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/luabind-user
Reply | Threaded
Open this post in threaded view
|

Re: unsigned byte color!

hymedia

Hey Tom,

 

My mistake, anyway you put it, both should be the same.

 

AFAIK, unsigned char (int8) on windows doesn’t seem to be supported, is there any known workaround, can a .def() include a static cast for instance?

 

 

From: Tom McCubbin [mailto:[hidden email]]
Sent: Tuesday, March 03, 2009 1:06 PM
To: [hidden email]
Subject: Re: [luabind] unsigned byte color!

 

Not to sound stupid, but why does your lua say:

myColor= Color4i(255, 0, 0, 100);

according to the luabind registration code, it should just be...

myColor=Color(255,0,0,100);

And lua internally supports plain ol' intergers ( int32 ...ok depends on platform but you get the point...)

so no matter what happens, this is likely going to be cast at runtime.  have a look at the c api for details as to the very minimal types supported w/in lua.




On Tue, 2009-03-03 at 12:36 -0500, hymedia wrote:

Hello everyone,

 

Any particular reason why Luabind is choking on UChar?

 

.cpp

 

typedef unsigned char UChar;

 

class Color

{

      public:

 

            UChar r, g, b, a;

 

            inline Color(UChar in_r, UChar in_g, UChar in_b, UChar in_a):

                  r(in_r),

                  g(in_g),

                  b(in_b),

                  a(in_a) {}

 

                  ///SNIP...

}

 

Luabind

 

module(in_lua)

[

      class_<Color>("Color")

      .def(constructor<UChar, UChar, UChar, UChar>())

];

 

.lua

 

myColor= Color4i(255, 0, 0, 100);

 

result: No matching overload found

 

If I repalce every UChar by a float it does work… hummm… hocus pocus…

 

 
------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________ luabind-user mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/luabind-user

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
luabind-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/luabind-user
Reply | Threaded
Open this post in threaded view
|

Re: unsigned byte color!

Tom McCubbin-2
Why not add a constructor that takes 4 ints (int32/64) and then do
a straight cast in the constructor initializer statement , or better yet use the Boost.NumericConversion library to do bounds checks, etc.

Can you change the class?  Add the additional signature, and if not why not derive from it, adding your own signature.


On Tue, 2009-03-03 at 13:20 -0500, hymedia wrote:
Hey Tom,

 

My mistake, anyway you put it, both should be the same.

 

AFAIK, unsigned char (int8) on windows doesn’t seem to be supported, is there any known workaround, can a .def() include a static cast for instance?

 

 

From: Tom McCubbin [mailto:[hidden email]]
Sent: Tuesday, March 03, 2009 1:06 PM
To: [hidden email]
Subject: Re: [luabind] unsigned byte color!


 

Not to sound stupid, but why does your lua say:

myColor= Color4i(255, 0, 0, 100);

according to the luabind registration code, it should just be...

myColor=Color(255,0,0,100);

And lua internally supports plain ol' intergers ( int32 ...ok depends on platform but you get the point...)

so no matter what happens, this is likely going to be cast at runtime.  have a look at the c api for details as to the very minimal types supported w/in lua.




On Tue, 2009-03-03 at 12:36 -0500, hymedia wrote:

Hello everyone,

 

Any particular reason why Luabind is choking on UChar?

 

.cpp

 

typedef unsigned char UChar;

 

class Color

{

      public:

 

            UChar r, g, b, a;

 

            inline Color(UChar in_r, UChar in_g, UChar in_b, UChar in_a):

                  r(in_r),

                  g(in_g),

                  b(in_b),

                  a(in_a) {}

 

                  ///SNIP...

}

 

Luabind

 

module(in_lua)

[

      class_<Color>("Color")

      .def(constructor<UChar, UChar, UChar, UChar>())

];

 

.lua

 

myColor= Color4i(255, 0, 0, 100);

 

result: No matching overload found

 

If I repalce every UChar by a float it does work… hummm… hocus pocus…

 



 
------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________ luabind-user mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/luabind-user
------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________ luabind-user mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/luabind-user

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
luabind-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/luabind-user
Reply | Threaded
Open this post in threaded view
|

Re: unsigned byte color!

Tony Kostanjsek
check the luabind archives, IIRC there was a bug that prevented uchar to work, but was fixed at some point in time. What luabind/lua/boost versions do you use?


Von: Tom McCubbin <[hidden email]>
An: [hidden email]
Gesendet: Dienstag, den 3. März 2009, 19:37:58 Uhr
Betreff: Re: [luabind] unsigned byte color!

Why not add a constructor that takes 4 ints (int32/64) and then do
a straight cast in the constructor initializer statement , or better yet use the Boost.NumericConversion library to do bounds checks, etc.

Can you change the class?  Add the additional signature, and if not why not derive from it, adding your own signature.


On Tue, 2009-03-03 at 13:20 -0500, hymedia wrote:
Hey Tom,

 

My mistake, anyway you put it, both should be the same.

 

AFAIK, unsigned char (int8) on windows doesn’t seem to be supported, is there any known workaround, can a .def() include a static cast for instance?

 

 

From: Tom McCubbin [mailto:[hidden email]]
Sent: Tuesday, March 03, 2009 1:06 PM
To: [hidden email]
Subject: Re: [luabind] unsigned byte color!


 

Not to sound stupid, but why does your lua say:

myColor= Color4i(255, 0, 0, 100);

according to the luabind registration code, it should just be...

myColor=Color(255,0,0,100);

And lua internally supports plain ol' intergers ( int32 ...ok depends on platform but you get the point...)

so no matter what happens, this is likely going to be cast at runtime.  have a look at the c api for details as to the very minimal types supported w/in lua.




On Tue, 2009-03-03 at 12:36 -0500, hymedia wrote:

Hello everyone,

 

Any particular reason why Luabind is choking on UChar?

 

.cpp

 

typedef unsigned char UChar;

 

class Color

{

      public:

 

            UChar r, g, b, a;

 

            inline Color(UChar in_r, UChar in_g, UChar in_b, UChar in_a):

                  r(in_r),

                  g(in_g),

                  b(in_b),

                  a(in_a) {}

 

                  ///SNIP...

}

 

Luabind

 

module(in_lua)

[

      class_<Color>("Color")

      .def(constructor<UChar, UChar, UChar, UChar>())

];

 

.lua

 

myColor= Color4i(255, 0, 0, 100);

 

result: No matching overload found

 

If I repalce every UChar by a float it does work… hummm… hocus pocus…

 



 
------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________ luabind-user mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/luabind-user
------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________ luabind-user mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/luabind-user


------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
luabind-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/luabind-user
Reply | Threaded
Open this post in threaded view
|

Re: unsigned byte color!

hymedia
In reply to this post by Tom McCubbin-2

Quote: Why not add a constructor that takes 4 ints (int32/64) and then do
a straight cast in the constructor initializer statement

 

That was my first attempt, but all my colors operators needed to be reworked, when I finally compiled all my colors were messed up, not going over that again.

 

Quote: Can you change the class?  Add the additional signature, and if not why not derive from it, adding your own signature.

 

To add to previous statement, I understand where you are coming from but in my humble opinion Luabind should Bind my code, not the other way around.

 

Quote: or better yet use the Boost.NumericConversion library to do bounds checks, etc.

 

Interesting, could you elaborate on this topic?

 

 

From: Tom McCubbin [mailto:[hidden email]]
Sent: Tuesday, March 03, 2009 1:38 PM
To: [hidden email]
Subject: Re: [luabind] unsigned byte color!

 

Why not add a constructor that takes 4 ints (int32/64) and then do
a straight cast in the constructor initializer statement , or better yet use the Boost.NumericConversion library to do bounds checks, etc.

Can you change the class?  Add the additional signature, and if not why not derive from it, adding your own signature.


On Tue, 2009-03-03 at 13:20 -0500, hymedia wrote:

Hey Tom,

 

My mistake, anyway you put it, both should be the same.

 

AFAIK, unsigned char (int8) on windows doesn’t seem to be supported, is there any known workaround, can a .def() include a static cast for instance?

 

 

From: Tom McCubbin [mailto:[hidden email]]
Sent: Tuesday, March 03, 2009 1:06 PM
To: [hidden email]
Subject: Re: [luabind] unsigned byte color!

 

Not to sound stupid, but why does your lua say:

myColor= Color4i(255, 0, 0, 100);

according to the luabind registration code, it should just be...

myColor=Color(255,0,0,100);

And lua internally supports plain ol' intergers ( int32 ...ok depends on platform but you get the point...)

so no matter what happens, this is likely going to be cast at runtime.  have a look at the c api for details as to the very minimal types supported w/in lua.




On Tue, 2009-03-03 at 12:36 -0500, hymedia wrote:

Hello everyone,

 

Any particular reason why Luabind is choking on UChar?

 

.cpp

 

typedef unsigned char UChar;

 

class Color

{

      public:

 

            UChar r, g, b, a;

 

            inline Color(UChar in_r, UChar in_g, UChar in_b, UChar in_a):

                  r(in_r),

                  g(in_g),

                  b(in_b),

                  a(in_a) {}

 

                  ///SNIP...

}

 

Luabind

 

module(in_lua)

[

      class_<Color>("Color")

      .def(constructor<UChar, UChar, UChar, UChar>())

];

 

.lua

 

myColor= Color4i(255, 0, 0, 100);

 

result: No matching overload found

 

If I repalce every UChar by a float it does work… hummm… hocus pocus…

 


 
 
------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________ luabind-user mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/luabind-user
 
------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________ luabind-user mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/luabind-user

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
luabind-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/luabind-user
Reply | Threaded
Open this post in threaded view
|

Re: unsigned byte color!

hymedia
In reply to this post by Tony Kostanjsek

I use the latest I believe, the windows version 0.8.

 

From: Tony Kostanjsek [mailto:[hidden email]]
Sent: Tuesday, March 03, 2009 1:42 PM
To: [hidden email]
Subject: Re: [luabind] unsigned byte color!

 

check the luabind archives, IIRC there was a bug that prevented uchar to work, but was fixed at some point in time. What luabind/lua/boost versions do you use?

 


Von: Tom McCubbin <[hidden email]>
An: [hidden email]
Gesendet: Dienstag, den 3. März 2009, 19:37:58 Uhr
Betreff: Re: [luabind] unsigned byte color!

Why not add a constructor that takes 4 ints (int32/64) and then do
a straight cast in the constructor initializer statement , or better yet use the Boost.NumericConversion library to do bounds checks, etc.

Can you change the class?  Add the additional signature, and if not why not derive from it, adding your own signature.


On Tue, 2009-03-03 at 13:20 -0500, hymedia wrote:

Hey Tom,

 

My mistake, anyway you put it, both should be the same.

 

AFAIK, unsigned char (int8) on windows doesn’t seem to be supported, is there any known workaround, can a .def() include a static cast for instance?

 

 

From: Tom McCubbin [mailto:[hidden email]]
Sent: Tuesday, March 03, 2009 1:06 PM
To: [hidden email]
Subject: Re: [luabind] unsigned byte color!

 

Not to sound stupid, but why does your lua say:

myColor= Color4i(255, 0, 0, 100);

according to the luabind registration code, it should just be...

myColor=Color(255,0,0,100);

And lua internally supports plain ol' intergers ( int32 ...ok depends on platform but you get the point...)

so no matter what happens, this is likely going to be cast at runtime.  have a look at the c api for details as to the very minimal types supported w/in lua.




On Tue, 2009-03-03 at 12:36 -0500, hymedia wrote:

Hello everyone,

 

Any particular reason why Luabind is choking on UChar?

 

.cpp

 

typedef unsigned char UChar;

 

class Color

{

      public:

 

            UChar r, g, b, a;

 

            inline Color(UChar in_r, UChar in_g, UChar in_b, UChar in_a):

                  r(in_r),

                  g(in_g),

                  b(in_b),

                  a(in_a) {}

 

                  ///SNIP...

}

 

Luabind

 

module(in_lua)

[

      class_<Color>("Color")

      .def(constructor<UChar, UChar, UChar, UChar>())

];

 

.lua

 

myColor= Color4i(255, 0, 0, 100);

 

result: No matching overload found

 

If I repalce every UChar by a float it does work… hummm… hocus pocus…

 


 
------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________ luabind-user mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/luabind-user
------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________ luabind-user mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/luabind-user

 


------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
luabind-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/luabind-user
Reply | Threaded
Open this post in threaded view
|

Re: unsigned byte color!

hymedia
In reply to this post by hymedia

Oups,

 

I use the latest windows version:

 

Luabind: 0.8

Lua: 5.1.4

Boost: 1.3.8

 

 

From: hymedia [mailto:[hidden email]]
Sent: Tuesday, March 03, 2009 1:54 PM
To: [hidden email]
Subject: Re: [luabind] unsigned byte color!

 

Quote: Why not add a constructor that takes 4 ints (int32/64) and then do
a straight cast in the constructor initializer statement

 

That was my first attempt, but all my colors operators needed to be reworked, when I finally compiled all my colors were messed up, not going over that again.

 

Quote: Can you change the class?  Add the additional signature, and if not why not derive from it, adding your own signature.

 

To add to previous statement, I understand where you are coming from but in my humble opinion Luabind should Bind my code, not the other way around.

 

Quote: or better yet use the Boost.NumericConversion library to do bounds checks, etc.

 

Interesting, could you elaborate on this topic?

 

 

From: Tom McCubbin [mailto:[hidden email]]
Sent: Tuesday, March 03, 2009 1:38 PM
To: [hidden email]
Subject: Re: [luabind] unsigned byte color!

 

Why not add a constructor that takes 4 ints (int32/64) and then do
a straight cast in the constructor initializer statement , or better yet use the Boost.NumericConversion library to do bounds checks, etc.

Can you change the class?  Add the additional signature, and if not why not derive from it, adding your own signature.


On Tue, 2009-03-03 at 13:20 -0500, hymedia wrote:

Hey Tom,

 

My mistake, anyway you put it, both should be the same.

 

AFAIK, unsigned char (int8) on windows doesn’t seem to be supported, is there any known workaround, can a .def() include a static cast for instance?

 

 

From: Tom McCubbin [mailto:[hidden email]]
Sent: Tuesday, March 03, 2009 1:06 PM
To: [hidden email]
Subject: Re: [luabind] unsigned byte color!

 

Not to sound stupid, but why does your lua say:

myColor= Color4i(255, 0, 0, 100);

according to the luabind registration code, it should just be...

myColor=Color(255,0,0,100);

And lua internally supports plain ol' intergers ( int32 ...ok depends on platform but you get the point...)

so no matter what happens, this is likely going to be cast at runtime.  have a look at the c api for details as to the very minimal types supported w/in lua.




On Tue, 2009-03-03 at 12:36 -0500, hymedia wrote:

Hello everyone,

 

Any particular reason why Luabind is choking on UChar?

 

.cpp

 

typedef unsigned char UChar;

 

class Color

{

      public:

 

            UChar r, g, b, a;

 

            inline Color(UChar in_r, UChar in_g, UChar in_b, UChar in_a):

                  r(in_r),

                  g(in_g),

                  b(in_b),

                  a(in_a) {}

 

                  ///SNIP...

}

 

Luabind

 

module(in_lua)

[

      class_<Color>("Color")

      .def(constructor<UChar, UChar, UChar, UChar>())

];

 

.lua

 

myColor= Color4i(255, 0, 0, 100);

 

result: No matching overload found

 

If I repalce every UChar by a float it does work… hummm… hocus pocus…

 

 
 
------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________ luabind-user mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/luabind-user
 
------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________ luabind-user mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/luabind-user

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
luabind-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/luabind-user
Reply | Threaded
Open this post in threaded view
|

Re: unsigned byte color!

Tony Kostanjsek
In reply to this post by hymedia
this is the change I meant:
http://github.com/luabind/luabind/commit/2efc88de35e43ef91ddc0a1a0d23c87a699caa95
Here's the previous message:
http://www.nabble.com/policy.hpp-has-no--%22unsigned-char%22-type-number-converer-td21385384.html
I've got a luabind 0.8 here that doesn't contain it yet, so maybe you give it a try.
best,
Tony


Von: hymedia <[hidden email]>
An: [hidden email]
Gesendet: Dienstag, den 3. März 2009, 20:14:21 Uhr
Betreff: Re: [luabind] unsigned byte color!

I use the latest I believe, the windows version 0.8.

 

From: Tony Kostanjsek [mailto:[hidden email]]
Sent: Tuesday, March 03, 2009 1:42 PM
To: [hidden email]
Subject: Re: [luabind] unsigned byte color!

 

check the luabind archives, IIRC there was a bug that prevented uchar to work, but was fixed at some point in time. What luabind/lua/boost versions do you use?

 


Von: Tom McCubbin <[hidden email]>
An: [hidden email]
Gesendet: Dienstag, den 3. März 2009, 19:37:58 Uhr
Betreff: Re: [luabind] unsigned byte color!

Why not add a constructor that takes 4 ints (int32/64) and then do
a straight cast in the constructor initializer statement , or better yet use the Boost.NumericConversion library to do bounds checks, etc.

Can you change the class?  Add the additional signature, and if not why not derive from it, adding your own signature.


On Tue, 2009-03-03 at 13:20 -0500, hymedia wrote:

Hey Tom,

 

My mistake, anyway you put it, both should be the same.

 

AFAIK, unsigned char (int8) on windows doesn’t seem to be supported, is there any known workaround, can a .def() include a static cast for instance?

 

 

From: Tom McCubbin [mailto:[hidden email]]
Sent: Tuesday, March 03, 2009 1:06 PM
To: [hidden email]
Subject: Re: [luabind] unsigned byte color!

 

Not to sound stupid, but why does your lua say:

myColor= Color4i(255, 0, 0, 100);

according to the luabind registration code, it should just be...

myColor=Color(255,0,0,100);

And lua internally supports plain ol' intergers ( int32 ...ok depends on platform but you get the point...)

so no matter what happens, this is likely going to be cast at runtime.  have a look at the c api for details as to the very minimal types supported w/in lua.




On Tue, 2009-03-03 at 12:36 -0500, hymedia wrote:

Hello everyone,

 

Any particular reason why Luabind is choking on UChar?

 

.cpp

 

typedef unsigned char UChar;

 

class Color

{

      public:

 

            UChar r, g, b, a;

 

            inline Color(UChar in_r, UChar in_g, UChar in_b, UChar in_a):

                  r(in_r),

                  g(in_g),

                  b(in_b),

                  a(in_a) {}

 

                  ///SNIP...

}

 

Luabind

 

module(in_lua)

[

      class_<Color>("Color")

      .def(constructor<UChar, UChar, UChar, UChar>())

];

 

.lua

 

myColor= Color4i(255, 0, 0, 100);

 

result: No matching overload found

 

If I repalce every UChar by a float it does work… hummm… hocus pocus…

 


 
------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________ luabind-user mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/luabind-user
------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________ luabind-user mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/luabind-user

 



------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
luabind-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/luabind-user
Reply | Threaded
Open this post in threaded view
|

Re: unsigned byte color!

hymedia

Humm… I m not quite sure what to do with this, I try to add the following into the policy.hpp and recompile Luabind lib:

 

struct default_converter<type const&> \

LUABIND_NUMBER_CONVERTER(char)

LUABIND_NUMBER_CONVERTER(signed char)

-LUABIND_NUMBER_CONVERTER(short)

+LUABIND_NUMBER_CONVERTER(unsigned char)

+LUABIND_NUMBER_CONVERTER(signed short)

LUABIND_NUMBER_CONVERTER(unsigned short)

-LUABIND_NUMBER_CONVERTER(int)

+LUABIND_NUMBER_CONVERTER(signed int)

LUABIND_NUMBER_CONVERTER(unsigned int)

-LUABIND_NUMBER_CONVERTER(long)

+LUABIND_NUMBER_CONVERTER(signed long)

LUABIND_NUMBER_CONVERTER(unsigned long)

LUABIND_NUMBER_CONVERTER(float)

LUABIND_NUMBER_CONVERTER(double)

 

Wont compile obviously… can you help clear this up?

 

Question:

 

1 - Is there a way to make the changes so I wont have to redo the changes if another version of luabind comes out, make the changes somehow in my project instead?

 

2 – Will this produce overheads for every other functions call via Luabind?

 

 

 

From: Tony Kostanjsek [mailto:[hidden email]]
Sent: Tuesday, March 03, 2009 3:05 PM
To: [hidden email]
Subject: Re: [luabind] unsigned byte color!

 

this is the change I meant:

http://github.com/luabind/luabind/commit/2efc88de35e43ef91ddc0a1a0d23c87a699caa95

Here's the previous message:

http://www.nabble.com/policy.hpp-has-no--%22unsigned-char%22-type-number-converer-td21385384.html

I've got a luabind 0.8 here that doesn't contain it yet, so maybe you give it a try.

best,

Tony

 


Von: hymedia <[hidden email]>
An: [hidden email]
Gesendet: Dienstag, den 3. März 2009, 20:14:21 Uhr
Betreff: Re: [luabind] unsigned byte color!

I use the latest I believe, the windows version 0.8.

 

From: Tony Kostanjsek [mailto:[hidden email]]
Sent: Tuesday, March 03, 2009 1:42 PM
To: [hidden email]
Subject: Re: [luabind] unsigned byte color!

 

check the luabind archives, IIRC there was a bug that prevented uchar to work, but was fixed at some point in time. What luabind/lua/boost versions do you use?

 


Von: Tom McCubbin <[hidden email]>
An: [hidden email]
Gesendet: Dienstag, den 3. März 2009, 19:37:58 Uhr
Betreff: Re: [luabind] unsigned byte color!

Why not add a constructor that takes 4 ints (int32/64) and then do
a straight cast in the constructor initializer statement , or better yet use the Boost.NumericConversion library to do bounds checks, etc.

Can you change the class?  Add the additional signature, and if not why not derive from it, adding your own signature.


On Tue, 2009-03-03 at 13:20 -0500, hymedia wrote:

Hey Tom,

 

My mistake, anyway you put it, both should be the same.

 

AFAIK, unsigned char (int8) on windows doesn’t seem to be supported, is there any known workaround, can a .def() include a static cast for instance?

 

 

From: Tom McCubbin [mailto:[hidden email]]
Sent: Tuesday, March 03, 2009 1:06 PM
To: [hidden email]
Subject: Re: [luabind] unsigned byte color!

 

Not to sound stupid, but why does your lua say:

myColor= Color4i(255, 0, 0, 100);

according to the luabind registration code, it should just be...

myColor=Color(255,0,0,100);

And lua internally supports plain ol' intergers ( int32 ...ok depends on platform but you get the point...)

so no matter what happens, this is likely going to be cast at runtime.  have a look at the c api for details as to the very minimal types supported w/in lua.




On Tue, 2009-03-03 at 12:36 -0500, hymedia wrote:

Hello everyone,

 

Any particular reason why Luabind is choking on UChar?

 

.cpp

 

typedef unsigned char UChar;

 

class Color

{

      public:

 

            UChar r, g, b, a;

 

            inline Color(UChar in_r, UChar in_g, UChar in_b, UChar in_a):

                  r(in_r),

                  g(in_g),

                  b(in_b),

                  a(in_a) {}

 

                  ///SNIP...

}

 

Luabind

 

module(in_lua)

[

      class_<Color>("Color")

      .def(constructor<UChar, UChar, UChar, UChar>())

];

 

.lua

 

myColor= Color4i(255, 0, 0, 100);

 

result: No matching overload found

 

If I repalce every UChar by a float it does work… hummm… hocus pocus…

 

 
------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________ luabind-user mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/luabind-user
------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________ luabind-user mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/luabind-user

 

 


------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
luabind-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/luabind-user
Reply | Threaded
Open this post in threaded view
|

Re: unsigned byte color!

Daniel Wallin
hymedia wrote:

> Humm… I m not quite sure what to do with this, I try to add the following into the policy.hpp and recompile Luabind lib:
>
> LUABIND_NUMBER_CONVERTER(char)
> LUABIND_NUMBER_CONVERTER(signed char)
> -LUABIND_NUMBER_CONVERTER(short)
> +LUABIND_NUMBER_CONVERTER(unsigned char)
> +LUABIND_NUMBER_CONVERTER(signed short)
> LUABIND_NUMBER_CONVERTER(unsigned short)
> -LUABIND_NUMBER_CONVERTER(int)
> +LUABIND_NUMBER_CONVERTER(signed int)
> LUABIND_NUMBER_CONVERTER(unsigned int)
> -LUABIND_NUMBER_CONVERTER(long)
> +LUABIND_NUMBER_CONVERTER(signed long)
> LUABIND_NUMBER_CONVERTER(unsigned long)
> LUABIND_NUMBER_CONVERTER(float)
> LUABIND_NUMBER_CONVERTER(double)
>
> Wont compile obviously… can you help clear this up?

That's a diff. The lines prefixed with '-' are removed, and the lines
prefixed with '+' are added. The resulting block looks like:

  LUABIND_NUMBER_CONVERTER(char)
  LUABIND_NUMBER_CONVERTER(signed char)
  LUABIND_NUMBER_CONVERTER(unsigned char)
  LUABIND_NUMBER_CONVERTER(signed short)
  LUABIND_NUMBER_CONVERTER(unsigned short)
  LUABIND_NUMBER_CONVERTER(signed int)
  LUABIND_NUMBER_CONVERTER(unsigned int)
  LUABIND_NUMBER_CONVERTER(signed long)
  LUABIND_NUMBER_CONVERTER(unsigned long)
  LUABIND_NUMBER_CONVERTER(float)
  LUABIND_NUMBER_CONVERTER(double)
  LUABIND_NUMBER_CONVERTER(long double)

> Question:
>
>  
>
> 1 - Is there a way to make the changes so I wont have to redo the
> changes if another version of luabind comes out, make the changes
> somehow in my project instead?

This was added after 0.8. It will be in 0.8.1 and all subsequent versions.

> 2 – Will this produce overheads for every other functions call via Luabind?

No.

--
Daniel Wallin
BoostPro Computing
http://www.boostpro.com

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
luabind-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/luabind-user
Reply | Threaded
Open this post in threaded view
|

Improving compile time!

hymedia
Greeting everyone,

Well, in spite of the fact that Luabind is quite powerful in what it does, it takes way too much time to compile, Having hundreds of functions makes the wait really painful... any tips and tricks on improving compile time?

thx


------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
luabind-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/luabind-user
Reply | Threaded
Open this post in threaded view
|

Re: Improving compile time!

Bjorn Toft Madsen-2
Split the registration up into several source files. That way, you don't have to recompile all the binding when one type changes.

Thanks,
Bjorn

-----Original Message-----
From: hymedia [mailto:[hidden email]]
Sent: 04 March 2009 15:54
To: [hidden email]
Subject: [luabind] Improving compile time!

Greeting everyone,

Well, in spite of the fact that Luabind is quite powerful in what it does, it takes way too much time to compile, Having hundreds of functions makes the wait really painful... any tips and tricks on improving compile time?

thx


------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
luabind-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/luabind-user


------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
luabind-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/luabind-user
Reply | Threaded
Open this post in threaded view
|

Re: Improving compile time!

Rodrigo (skhaz)
In reply to this post by hymedia
Hi,

try disable the swap memory

On Wed, Mar 4, 2009 at 12:54 PM, hymedia <[hidden email]> wrote:

> Greeting everyone,
>
> Well, in spite of the fact that Luabind is quite powerful in what it does, it takes way too much time to compile, Having hundreds of functions makes the wait really painful... any tips and tricks on improving compile time?
>
> thx
>
>
> ------------------------------------------------------------------------------
> Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
> -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
> -Strategies to boost innovation and cut costs with open source participation
> -Receive a $600 discount off the registration fee with the source code: SFAD
> http://p.sf.net/sfu/XcvMzF8H
> _______________________________________________
> luabind-user mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/luabind-user
>



--
http://www.skhaz.com/

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
luabind-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/luabind-user
12