Re: unsigned byte color!
Tony Kostanjsek <[email protected]>
| Newsgroups | gmane.comp.lang.lua.bind.user |
|---|---|
| Message-ID | <[email protected]> |
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 <[email protected]> An: [email protected] 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:[email protected]] Sent: Tuesday, March 03, 2009 1:42 PM To: [email protected] 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 <[email protected]> An: [email protected] 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:[email protected]] Sent: Tuesday, March 03, 2009 1:06 PM To: [email protected] 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 [email protected] 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 [email protected] 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 [email protected] https://lists.sourceforge.net/lists/listinfo/luabind-user