Re: Deriving in lua, more then 10 parameters for a method
Roman Kubiak <[email protected]> Thu, 4 Sep 2014 21:41:39 +0200
| Newsgroups | gmane.comp.lang.lua.bind.user |
|---|---|
| Message-ID | <CACugK=bEVBiZCwAE-tno3cNjuNrU9uDFLSGLhBrK4m14fTeacQ@mail.gmail.com> |
--===============5646498208657347906==
Content-Type: multipart/alternative; boundary=f46d04447e278fc42e0502428a2e
--f46d04447e278fc42e0502428a2e
Content-Type: text/plain; charset=UTF-8
Like i wrote, increasing that constant above 10 is impossible, you'll get
flooded with compile errors, if that constant goes above 10 something needs
to change in boost to handle that. My question what and how, i'm not a big
boost expert, i use it only for luabind so i was wondering if there was a
ready solution to get this working.
cheers.
====================================================================
_ _ _ _ _ _
__ _____| | |_ __ _ __ _ ___ __ ___ _ _| |_ _ _ ___| | |___ __| |
\ V / _ \ | _/ _` / _` / -_) / _/ _ \ ' \ _| '_/ _ \ | / -_) _` |
\_/\___/_|\__\__,_\__, \___| \__\___/_||_\__|_| \___/_|_\___\__,_|
|___/
====================================================================
On Thu, Sep 4, 2014 at 7:18 PM, Chris Byrne <[email protected]> wrote:
> I would second that approach.
>
>
> If you really want to go down the path of binding functions with more than
> 10 arguments, then I think you need to define LUABIND_MAX_ARITY with a
> value greater than 10.
>
> 10 being the default value if LUABIND_MAX_ARITY is not already defined:
> https://github.com/luabind/luabind/blob/master/luabind/config.hpp
>
> This is used during pre-processing to expand out and provide the necessary
> binding overloads (predating variadic templates).
>
>
> I haven't tried this, so I can't promise that this is the only definition
> (or even the correct one). There is likely a similar limitation/definition
> within boost as well.
>
>
> Kind Regards,
> CB
>
>
> On Thu, Sep 4, 2014 at 9:51 AM, Andreas Grob <[email protected]>
> wrote:
>
>> Hi,
>>
>> How about wrapping the whole L&F class to have a cleaner interface? You
>> could store the original L&F inside that wrapper using pimpl and have a
>> method to move it out.
>>
>> Regards,
>> Andreas
>>
>> Am 04.09.2014 16:12, schrieb Roman Kubiak:
>>
>> Helo.
>>
>>
>> I'm using a third party library for my application (JUCE), this library
>> has a large class called LookAndFeel, i want to expose that class to lua
>> via luabind.
>>
>> I started to do the work following the documentation, and using the
>> luabind::wrap_base approach, i got a few methods bound and it's all working
>> fine, until i hit a problem. Some of the methods in the original
>> LookAndFeel class have more then 10 parameters, and i can't bind those
>> methods using this approach.
>>
>> One of the solutions i found would be to change the parameters and wrap
>> them in a structure, and that would be a good idea but i can't change the
>> original LookAndFeel class, and changing the class that derives from
>> luabind::wrap_base - that i'm implementing - so that it's methods take a
>> structure as a parameter instead of the actual parameters, makes those
>> methods unusable (luabind never calls them, since the parameter count and
>> type does not match the original LookAndFeel class).
>>
>> Is there a way to solve this somehow, can i increase the limit of 10
>> parameters in luabind (trying to extend the ARITY macro over 10 causes
>> loades of compile errors).
>>
>> Any help is welcome.
>>
>> My class looks like:
>> class LLookAndFeel : public LookAndFeel_V3, public luabind::wrap_base
>> {
>> virtual void drawButtonBackground (Graphics &g, Button &b, const
>> Colour &c, bool over, bool down) override
>> { call<void>("drawButtonBackground", boost::ref (g),
>> boost::ref(b), c, over, down); }
>> static void def_drawButtonBackground (LookAndFeel_V3 *ptr,
>> Graphics &g, Button &b, const Colour &c, bool over, bool down)
>> { return (ptr->LookAndFeel_V3::drawButtonBackground
>> (g,b,c,over,down)); }
>>
>> /* More methods are needed that have more then 10 parameters */
>> }
>>
>> Best regards.
>>
>> Roman Kubiak
>> http://ctrlr.org
>> ====================================================================
>> _ _ _ _ _ _
>> __ _____| | |_ __ _ __ _ ___ __ ___ _ _| |_ _ _ ___| | |___ __| |
>> \ V / _ \ | _/ _` / _` / -_) / _/ _ \ ' \ _| '_/ _ \ | / -_) _` |
>> \_/\___/_|\__\__,_\__, \___| \__\___/_||_\__|_| \___/_|_\___\__,_|
>> |___/
>> ====================================================================
>>
>>
>>
>>
>>
>> ------------------------------------------------------------------------------
>> Slashdot TV.
>> Video for Nerds. Stuff that matters.http://tv.slashdot.org/
>>
>>
>>
>> _______________________________________________
>> luabind-user mailing [email protected]://lists.sourceforge.net/lists/listinfo/luabind-user
>>
>>
>>
>
>
> ------------------------------------------------------------------------------
> Slashdot TV.
> Video for Nerds. Stuff that matters.
> http://tv.slashdot.org/
> _______________________________________________
> luabind-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/luabind-user
>
>
--f46d04447e278fc42e0502428a2e
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><div class=3D"gmail_default" style=3D"font-family:courier =
new,monospace">Like i wrote, increasing that constant above 10 is impossibl=
e, you'll get flooded with compile errors, if that constant goes above =
10 something needs to change in boost to handle that. My question what and =
how, i'm not a big boost expert, i use it only for luabind so i was won=
dering if there was a ready solution to get this working.<br>
<br>cheers.<br></div></div><div class=3D"gmail_extra"><br clear=3D"all"><di=
v><font size=3D"1">=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
<br><span style=3D"font-family:courier new,monospace">=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0 _ _=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 _=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 _ _=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0 _</span><br style=3D"font-family:courier new,monospace">
<span style=3D"font-family:courier new,monospace">__ _____| | |_ __ _ __ _ =
___=C2=A0=C2=A0 __ ___ _ _| |_ _ _ ___| | |___ __| |</span><br style=3D"fon=
t-family:courier new,monospace"><span style=3D"font-family:courier new,mono=
space">\ V / _ \ |=C2=A0 _/ _` / _` / -_) / _/ _ \ ' \=C2=A0 _| '_/=
_ \ | / -_) _` |</span><br style=3D"font-family:courier new,monospace">
<span style=3D"font-family:courier new,monospace">=C2=A0\_/\___/_|\__\__,_\=
__, \___| \__\___/_||_\__|_| \___/_|_\___\__,_|</span><br style=3D"font-fam=
ily:courier new,monospace"><span style=3D"font-family:courier new,monospace=
">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 |___/</span><br>
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D<br style=3D"font-fam=
ily:courier new,monospace"><br style=3D"font-family:courier new,monospace">=
<br style=3D"font-family:courier new,monospace"></font><br></div>
<br><br><div class=3D"gmail_quote">On Thu, Sep 4, 2014 at 7:18 PM, Chris By=
rne <span dir=3D"ltr"><<a href=3D"mailto:[email protected]" target=
=3D"_blank">[email protected]</a>></span> wrote:<br><blockquote clas=
s=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;pad=
ding-left:1ex">
<div dir=3D"ltr">I would second that approach.<div><br></div><div><br></div=
><div>If you really want to go down the path of binding functions with more=
than 10 arguments, then I think you need to define LUABIND_MAX_ARITY with =
a value greater than 10.</div>
<div><br></div><div>10 being the default value if LUABIND_MAX_ARITY is not =
already defined:</div><div>=C2=A0<a href=3D"https://github.com/luabind/luab=
ind/blob/master/luabind/config.hpp" target=3D"_blank">https://github.com/lu=
abind/luabind/blob/master/luabind/config.hpp</a><br>
</div><div><br></div><div>This is used during pre-processing to expand out =
and provide the necessary binding overloads (predating variadic templates).=
</div><div><br></div><div><br></div><div>I haven't tried this, so I can=
't promise that this is the only definition (or even the correct one). =
There is likely a similar limitation/definition within boost as well.</div>
<div><br></div><div><br></div><div>Kind Regards,</div><div>=C2=A0CB</div><d=
iv class=3D"gmail_extra"><br></div><div class=3D"gmail_extra"><br><div clas=
s=3D"gmail_quote"><div class=3D"">On Thu, Sep 4, 2014 at 9:51 AM, Andreas G=
rob <span dir=3D"ltr"><<a href=3D"mailto:[email protected]" ta=
rget=3D"_blank">[email protected]</a>></span> wrote:<br>
</div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;b=
order-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:s=
olid;padding-left:1ex">
<div bgcolor=3D"#FFFFFF"><div class=3D"">
<div>Hi,<br>
<br>
How about wrapping the whole L&F class to have a cleaner interface? You=
could store the original L&F inside that wrapper using pimpl and have =
a method to move it out.<br>
<br>
Regards,<br>
Andreas<br>
<br>
Am 04.09.2014 16:12, schrieb Roman Kubiak:<br>
</div>
</div><blockquote type=3D"cite"><div><div>
<div dir=3D"ltr">
<div style=3D"font-family:'courier new',monospace">Helo.<div><div c=
lass=3D"h5"><br>
<br>
I'm using a third party library for my application (JUCE), this library=
has a large class called LookAndFeel, i want to expose that class to lua v=
ia luabind.<br>
<br>
I started to do the work following the documentation, and using the luabind=
::wrap_base approach, i got a few methods bound and it's all working fi=
ne, until i hit a problem. Some of the methods in the original LookAndFeel =
class have more then 10 parameters,
and i can't bind those methods using this approach.<br>
<br>
</div></div></div><div><div class=3D"h5">
<div style=3D"font-family:'courier new',monospace">One of the solut=
ions i found would be to change the parameters and wrap them in a structure=
, and that would be a good idea but i can't change the original LookAnd=
Feel class, and
changing the class that derives from luabind::wrap_base - that i'm imp=
lementing - so that it's methods take a structure as a parameter instea=
d of the actual parameters, makes those methods unusable (luabind never cal=
ls them, since the parameter count and type
does not match the original LookAndFeel class).<br>
<br>
</div>
<div style=3D"font-family:'courier new',monospace">Is there a way t=
o solve this somehow, can i increase the limit of 10 parameters in luabind =
(trying to extend the ARITY macro over 10 causes loades of compile errors).=
<br>
<br>
</div>
<div style=3D"font-family:'courier new',monospace">Any help is welc=
ome.<br>
<br>
</div>
<div style=3D"font-family:'courier new',monospace">My class looks l=
ike:<br>
class LLookAndFeel : public LookAndFeel_V3, public luabind::wrap_base<br>
{<br>
=C2=A0=C2=A0=C2=A0=C2=A0 virtual void drawButtonBackground (Graphics &g=
, Button &b, const Colour &c, bool over, bool down) override<br>
=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 { call<void>=
("drawButtonBackground", boost::ref (g), boost::ref(b), c, over, =
down); }<br>
=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 static void def_drawButtonBackground =
(LookAndFeel_V3 *ptr, Graphics &g, Button &b, const Colour &c, =
bool over, bool down)<br>
=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 { return (ptr->=
LookAndFeel_V3::drawButtonBackground (g,b,c,over,down)); }<br>
<br>
</div>
<div style=3D"font-family:'courier new',monospace">/* More methods =
are needed that have more then 10 parameters */<br>
</div>
<div style=3D"font-family:'courier new',monospace">}<br>
<br>
</div>
<div style=3D"font-family:'courier new',monospace">Best regards.<br=
>
<br>
Roman Kubiak<br>
<a href=3D"http://ctrlr.org" target=3D"_blank">http://ctrlr.org</a><br clea=
r=3D"all">
</div>
<div><font size=3D"1">=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D<br>
<span style=3D"font-family:'courier new',monospace">=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 _ _=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 _=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 _ _=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0 _</span><br style=3D"font-family:'courier new&=
#39;,monospace">
<span style=3D"font-family:'courier new',monospace">__ _____| | |_ =
__ _ __ _ ___=C2=A0=C2=A0 __ ___ _ _| |_ _ _ ___| | |___ __| |</span><br st=
yle=3D"font-family:'courier new',monospace">
<span style=3D"font-family:'courier new',monospace">\ V / _ \ |=C2=
=A0 _/ _` / _` / -_) / _/ _ \ ' \=C2=A0 _| '_/ _ \ | / -_) _` |</sp=
an><br style=3D"font-family:'courier new',monospace">
<span style=3D"font-family:'courier new',monospace">=C2=A0\_/\___/_=
|\__\__,_\__, \___| \__\___/_||_\__|_| \___/_|_\___\__,_|</span><br style=
=3D"font-family:'courier new',monospace">
<span style=3D"font-family:'courier new',monospace">=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0 |___/</span><br>
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D<br style=3D"font-fam=
ily:'courier new',monospace">
<br style=3D"font-family:'courier new',monospace">
<br style=3D"font-family:'courier new',monospace">
</font><br>
</div>
</div></div></div>
<br>
<fieldset></fieldset> <br>
</div></div><div class=3D""><pre>------------------------------------------=
------------------------------------
Slashdot TV. =20
Video for Nerds. Stuff that matters.
<a href=3D"http://tv.slashdot.org/" target=3D"_blank">http://tv.slashdot.or=
g/</a></pre>
<br>
<fieldset></fieldset> <br>
<pre>_______________________________________________
luabind-user mailing list
<a href=3D"mailto:[email protected]" target=3D"_blank">lua=
[email protected]</a>
<a href=3D"https://lists.sourceforge.net/lists/listinfo/luabind-user" targe=
t=3D"_blank">https://lists.sourceforge.net/lists/listinfo/luabind-user</a>
</pre>
</div></blockquote>
<br>
</div>
</blockquote></div><br></div></div>
<br>-----------------------------------------------------------------------=
-------<br>
Slashdot TV.<br>
Video for Nerds.=C2=A0 Stuff that matters.<br>
<a href=3D"http://tv.slashdot.org/" target=3D"_blank">http://tv.slashdot.or=
g/</a><br>_______________________________________________<br>
luabind-user mailing list<br>
<a href=3D"mailto:[email protected]">[email protected]=
urceforge.net</a><br>
<a href=3D"https://lists.sourceforge.net/lists/listinfo/luabind-user" targe=
t=3D"_blank">https://lists.sourceforge.net/lists/listinfo/luabind-user</a><=
br>
<br></blockquote></div><br></div>
--f46d04447e278fc42e0502428a2e--
--===============5646498208657347906==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
------------------------------------------------------------------------------
Slashdot TV.
Video for Nerds. Stuff that matters.
http://tv.slashdot.org/
--===============5646498208657347906==
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
--===============5646498208657347906==--