Re: adding new primitive types to luabind

Ilya Martynov <[email protected]>
Newsgroups gmane.comp.lang.lua.bind.user
Message-ID <[email protected]>
On Tue, Nov 3, 2009 at 11:27 AM, Daniel Wallin <[email protected]> wrote:

> Ilya Martynov wrote:
> > Hello,
> >
> > I've just started using luabind for my project and run into the following
> > issue. C++ API I'm trying to expose to lua uses 64 bit integer type which
> > luabind cannot use unless I specially register this type as a class. But
> if
> > I register it as a class I have to convert lua numbers to this class
> > explicitly in my lua code. Ideally I want to be able to add somehow it as
> a
> > native type so that luabind would be able to resolve calls like
> > "c_func_with_64bit_int_parameter(1234)" automatically without explicit
> > conversion. Basically I want to be able to use this type in the same way
> as
> > other numeric types which are supported by luabind natively (i.e. int and
> > double). Is it possible at all?
>
> Yes, it is possible. Please see test/test_user_defined_converter.cpp or
> the "Adding converters for user defined types" section in the
> documentation. It boils down to specializing
> luabind::default_converter<> for your type.
>
>
>
Aha, thanks. I initially was looking into documentation on
http://www.rasterbar.com/products/luabind/docs.html but it seems to be
outdated and doesn't have this section.

-- 
Ilya Martynov, [email protected]
CTO IPonWEB (UK) Ltd

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference

_______________________________________________
luabind-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/luabind-user
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.