Re: binding reference to scalar types: shouldn't it work already?
Lorenzo Pistone <[email protected]> Thu, 18 Apr 2013 10:02:25 +0200
| Newsgroups | gmane.comp.lang.lua.bind.user |
|---|---|
| Message-ID | <[email protected]> |
This is a multi-part message in MIME format. --===============4956916249987892501== Content-Type: multipart/alternative; boundary="------------070204000109070604020101" This is a multi-part message in MIME format. --------------070204000109070604020101 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit well, is there any other suggested way to bind a reference to a scalar type? Being a very simple and common operation, I would think that this has been foreseen in the library. On 04/18/2013 09:49 AM, Szymon Gatner wrote: > boost::ref creates object of type boost::reference_wrapper<T> not T&. > This type obviously isn't known to luabind. > > > 2013/4/10 Lorenzo Pistone <[email protected] > <mailto:[email protected]>> > > Hello, > I'm trying to bind a reference to a bool. This thing compiles: > > globals(L)["dotrap"] = boost::ref(dotrap); > > but at compile time I get the following exception: > > terminate called after throwing an instance of > 'std::runtime_error' > what(): Trying to use unregistered class > > It looks like that luabind is treating a reference to a bool as a user > defined type. So... it isn't able by default to bind references to > simple bools? > By the way, luabind does know about bool, in fact I can do > > globals(L)["dotrap"] = dotrap; > > but here I create a copy of the value, which is not what I want to do. > > Cheers. > > ------------------------------------------------------------------------------ > Precog is a next-generation analytics platform capable of advanced > analytics on semi-structured data. The platform includes APIs for > building > apps and a phenomenal toolset for data science. Developers can use > our toolset for easy data analysis & visualization. Get a free > account! > http://www2.precog.com/precogplatform/slashdotnewsletter > _______________________________________________ > luabind-user mailing list > [email protected] > <mailto:[email protected]> > https://lists.sourceforge.net/lists/listinfo/luabind-user > > > > > -- > Szymon Gatner > The Lordz Games Studio > www.thelordzgamesstudio.com <http://www.thelordzgamesstudio.com> > > > ------------------------------------------------------------------------------ > Precog is a next-generation analytics platform capable of advanced > analytics on semi-structured data. The platform includes APIs for building > apps and a phenomenal toolset for data science. Developers can use > our toolset for easy data analysis & visualization. Get a free account! > http://www2.precog.com/precogplatform/slashdotnewsletter > > > _______________________________________________ > luabind-user mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/luabind-user --------------070204000109070604020101 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit <html> <head> <meta content="text/html; charset=ISO-8859-1" http-equiv="Content-Type"> </head> <body bgcolor="#FFFFFF" text="#000000"> <div class="moz-cite-prefix"><tt>well, is there any other suggested way to bind a reference to a scalar type? Being a very simple and common operation, I would think that this has been foreseen in the library.</tt><br> <br> On 04/18/2013 09:49 AM, Szymon Gatner wrote:<br> </div> <blockquote cite="mid:CALqx0+U_tCdtS50fPuuvuq3mirYnA8UEctQnwFbupnqd_PLGBg@mail.gmail.com" type="cite"> <div dir="ltr">boost::ref creates object of type boost::reference_wrapper<T> not T&. This type obviously isn't known to luabind.</div> <div class="gmail_extra"><br> <br> <div class="gmail_quote">2013/4/10 Lorenzo Pistone <span dir="ltr"><<a moz-do-not-send="true" href="mailto:[email protected]" target="_blank">[email protected]</a>></span><br> <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello,<br> I'm trying to bind a reference to a bool. This thing compiles:<br> <br> globals(L)["dotrap"] = boost::ref(dotrap);<br> <br> but at compile time I get the following exception:<br> <br> terminate called after throwing an instance of 'std::runtime_error'<br> what(): Trying to use unregistered class<br> <br> It looks like that luabind is treating a reference to a bool as a user<br> defined type. So... it isn't able by default to bind references to<br> simple bools?<br> By the way, luabind does know about bool, in fact I can do<br> <br> globals(L)["dotrap"] = dotrap;<br> <br> but here I create a copy of the value, which is not what I want to do.<br> <br> Cheers.<br> <br> ------------------------------------------------------------------------------<br> Precog is a next-generation analytics platform capable of advanced<br> analytics on semi-structured data. The platform includes APIs for building<br> apps and a phenomenal toolset for data science. Developers can use<br> our toolset for easy data analysis & visualization. Get a free account!<br> <a moz-do-not-send="true" href="http://www2.precog.com/precogplatform/slashdotnewsletter" target="_blank">http://www2.precog.com/precogplatform/slashdotnewsletter</a><br> _______________________________________________<br> luabind-user mailing list<br> <a moz-do-not-send="true" href="mailto:[email protected]">[email protected]</a><br> <a moz-do-not-send="true" href="https://lists.sourceforge.net/lists/listinfo/luabind-user" target="_blank">https://lists.sourceforge.net/lists/listinfo/luabind-user</a><br> </blockquote> </div> <br> <br clear="all"> <div><br> </div> -- <br> Szymon Gatner<br> The Lordz Games Studio<br> <a moz-do-not-send="true" href="http://www.thelordzgamesstudio.com" target="_blank">www.thelordzgamesstudio.com</a> </div> <br> <fieldset class="mimeAttachmentHeader"></fieldset> <br> <pre wrap="">------------------------------------------------------------------------------ Precog is a next-generation analytics platform capable of advanced analytics on semi-structured data. The platform includes APIs for building apps and a phenomenal toolset for data science. Developers can use our toolset for easy data analysis & visualization. Get a free account! <a class="moz-txt-link-freetext" href="http://www2.precog.com/precogplatform/slashdotnewsletter">http://www2.precog.com/precogplatform/slashdotnewsletter</a></pre> <br> <fieldset class="mimeAttachmentHeader"></fieldset> <br> <pre wrap="">_______________________________________________ luabind-user mailing list <a class="moz-txt-link-abbreviated" href="mailto:[email protected]">[email protected]</a> <a class="moz-txt-link-freetext" href="https://lists.sourceforge.net/lists/listinfo/luabind-user">https://lists.sourceforge.net/lists/listinfo/luabind-user</a> </pre> </blockquote> <br> </body> </html> --------------070204000109070604020101-- --===============4956916249987892501== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ------------------------------------------------------------------------------ Precog is a next-generation analytics platform capable of advanced analytics on semi-structured data. The platform includes APIs for building apps and a phenomenal toolset for data science. Developers can use our toolset for easy data analysis & visualization. Get a free account! http://www2.precog.com/precogplatform/slashdotnewsletter --===============4956916249987892501== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ luabind-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/luabind-user --===============4956916249987892501==--