Deriving in lua, more then 10 parameters for a method

Roman Kubiak <[email protected]> Thu, 4 Sep 2014 16:12:32 +0200
Newsgroups gmane.comp.lang.lua.bind.user
Message-ID <CACugK=YQhD+eqch7XKs9EM65wg95N-CVrZeiPGzZ2DZ7+5WTiw@mail.gmail.com>
--===============3314180593250732014==
Content-Type: multipart/alternative; boundary=001a1134dede9023a405023df1bc

--001a1134dede9023a405023df1bc
Content-Type: text/plain; charset=UTF-8

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 / _ \ |  _/ _` / _` / -_) / _/ _ \ ' \  _| '_/ _ \ | / -_) _` |
 \_/\___/_|\__\__,_\__, \___| \__\___/_||_\__|_| \___/_|_\___\__,_|
                   |___/
====================================================================

--001a1134dede9023a405023df1bc
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">Helo.<br><br>I&#39;m using a third party library for my appl=
ication (JUCE), this library has a large class called LookAndFeel, i want t=
o expose that class to lua via luabind.<br>
<br>I started to do the work following the documentation, and using the lua=
bind::wrap_base approach, i got a few methods bound and it&#39;s all workin=
g fine, until i hit a problem. Some of the methods in the original LookAndF=
eel class have more then 10 parameters, and i can&#39;t bind those methods =
using this approach.<br>
<br></div><div class=3D"gmail_default" style=3D"font-family:courier new,mon=
ospace">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&#39;t cha=
nge the original LookAndFeel class, and changing the class that derives fro=
m luabind::wrap_base - that i&#39;m implementing - so that it&#39;s methods=
 take a structure as a parameter instead of the actual parameters, makes th=
ose methods unusable (luabind never calls them, since the parameter count a=
nd type does not match the original LookAndFeel class).<br>
<br></div><div class=3D"gmail_default" style=3D"font-family:courier new,mon=
ospace">Is there a way to solve this somehow, can i increase the limit of 1=
0 parameters in luabind (trying to extend the ARITY macro over 10 causes lo=
ades of compile errors).<br>
<br></div><div class=3D"gmail_default" style=3D"font-family:courier new,mon=
ospace">Any help is welcome.<br><br></div><div class=3D"gmail_default" styl=
e=3D"font-family:courier new,monospace">My class looks like:<br>class LLook=
AndFeel : public LookAndFeel_V3, public luabind::wrap_base<br>
{<br>=C2=A0=C2=A0=C2=A0=C2=A0 virtual void drawButtonBackground (Graphics &=
amp;g, Button &amp;b, const Colour &amp;c, bool over, bool down) override<b=
r>=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 { call&lt;void&g=
t;(&quot;drawButtonBackground&quot;, 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 &amp;g, Button &amp;b, const Colour &amp;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-&gt;LookAndFeel_V3::drawButtonBackground (g,b,c,over,d=
own)); }<br>
<br></div><div class=3D"gmail_default" style=3D"font-family:courier new,mon=
ospace">/* More methods are needed that have more then 10 parameters */<br>=
</div><div class=3D"gmail_default" style=3D"font-family:courier new,monospa=
ce">
}<br><br></div><div class=3D"gmail_default" style=3D"font-family:courier ne=
w,monospace">Best regards.<br><br>Roman Kubiak<br><a href=3D"http://ctrlr.o=
rg">http://ctrlr.org</a><br clear=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,monospace"><sp=
an style=3D"font-family:courier new,monospace">__ _____| | |_ __ _ __ _ ___=
=C2=A0=C2=A0 __ ___ _ _| |_ _ _ ___| | |___ __| |</span><br style=3D"font-f=
amily:courier new,monospace">
<span style=3D"font-family:courier new,monospace">\ V / _ \ |=C2=A0 _/ _` /=
 _` / -_) / _/ _ \ &#39; \=C2=A0 _| &#39;_/ _ \ | / -_) _` |</span><br styl=
e=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-family:courier new,monospace"><br style=3D"font-fam=
ily:courier new,monospace">
<br style=3D"font-family:courier new,monospace"></font><br></div>
</div>

--001a1134dede9023a405023df1bc--


--===============3314180593250732014==
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/
--===============3314180593250732014==
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

--===============3314180593250732014==--