Re: passing a reference to a primitive?

Nigel Atkinson <[email protected]> Wed, 07 Nov 2012 15:30:28 +1100
Newsgroups gmane.comp.lang.lua.bind.user
Message-ID <1352262628.15021.1.camel@Ephebe>
I've just installed the default luabind package on Fedora 17, and I can
confirm it has the same issue. :-/

Doh!

Nigel

On Tue, 2012-11-06 at 13:57 -0600, Cory Riddell wrote:
> I've been working through some of the examples and I can't figure out
> what's wrong.
> 
> I have a function that takes a reference to a double:
> 
>   void fn(double& value) {
>     value += 3.4;
>   }
> 
> I bind it with code that looks something like:
> 
>   module(L) [
>     def("fn", fn)
>   ]:
> 
> Then try to run it:
>  
>   luaL_dostring(
>     L,
>     "fval = 3.2\n"
>     "fn(fval)\n"
>   );
> 
> I get back an error that says something like:
> 
>   No matching overload found, candidates:
>   void fn(custom [double]&)
> 
> I've tried being super-specific by binding fn like this:
> 
>   def("fn", (void(*)(double&)fn)
> 
> but I get the same result. I'm really trying to use the out_value
> policy, but I can't even get this to compile:
> 
>   def("fn", fn, out_value(_1))
> 
> FWIW, I'm using VS2010.
> 
> I'm starting to wonder if I should just stick to the Lua's C api and try
> to keep my dependencies to a minimum. Frankly, when I try to figure out
> how luabind is working, it pretty much looks like magic.
> 
> The canonical version of luabind doesn't appear to be maintained any
> more. I know some people on this list are maintaining forks and I'm
> wondering if their version of luabind works for what I'm trying to do?
> I've started to play with boost-python. It seems much heavier and more
> complicated, but also more active.
> 
> Advice and suggestions welcomed!
> 
> Thanks,
> Cory
> 
> 
> 
> ------------------------------------------------------------------------------
> LogMeIn Central: Instant, anywhere, Remote PC access and management.
> Stay in control, update software, and manage PCs from one command center
> Diagnose problems and improve visibility into emerging IT issues
> Automate, monitor and manage. Do more in less time with Central
> http://p.sf.net/sfu/logmein12331_d2d
> _______________________________________________
> luabind-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/luabind-user



------------------------------------------------------------------------------
LogMeIn Central: Instant, anywhere, Remote PC access and management.
Stay in control, update software, and manage PCs from one command center
Diagnose problems and improve visibility into emerging IT issues
Automate, monitor and manage. Do more in less time with Central
http://p.sf.net/sfu/logmein12331_d2d