[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: binding a c++ unary_function to lua
- From: Mark Gossage <mark@...>
- Date: Wed, 9 Jan 2008 01:45:08 +0000 (GMT)
<ab83bf010801071005g6f94cf6auebd487525c5f54a4@mail.gmail.com><d06901f0801071053p9dbefc4ga281c1f0e95ebe05@mail.gmail.com>
> Panagiotis Vossos wrote:
> > Is there any easy way to make it available to lua as a normal function?
> >
> I think __call metamethod is what you are seeking.
>
> Some untested and dirty (requires closure per functor
and copy
> constructor) code:
> [snipped]
Hello d06901f0801071053p9dbefc4ga281c1f0e95ebe05@mail.gmail.com>ab83bf010801071005g6f94cf6auebd487525c5f54a4@mail.gmail.com>Panagiotis,
Wouldn't it have been easier to just use an auto binding generator (SWIG, tolua, etc)?
<ab83bf010801071005g6f94cf6auebd487525c5f54a4@mail.gmail.com><d06901f0801071053p9dbefc4ga281c1f0e95ebe05@mail.gmail.com>
SWIG would happily have accepted
bool
d06901f0801071053p9dbefc4ga281c1f0e95ebe05@mail.gmail.com>ab83bf010801071005g6f94cf6auebd487525c5f54a4@mail.gmail.com>validate(int);
bool isalnum(int);
bool isalpha(int);
....
and similar
<ab83bf010801071005g6f94cf6auebd487525c5f54a4@mail.gmail.com><d06901f0801071053p9dbefc4ga281c1f0e95ebe05@mail.gmail.com>
Just a
though,
Mark
d06901f0801071053p9dbefc4ga281c1f0e95ebe05@mail.gmail.com>ab83bf010801071005g6f94cf6auebd487525c5f54a4@mail.gmail.com>
Sent from Yahoo! - a smarter inbox.