lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 12/21/2010 6:22 AM, Christian Tellefsen wrote:
> I looked at some Lua wrappers a while back.
> 
> After a bit of evaluation, I decided to add our own wrappers and added
> push_xxx, to_xxx and check_xxx functions that know about our classes /
> vectors / enumerations and so on, in the same style as the normal Lua C
> interface.

In retrospect, that's roughly what I should have done. But I have
tolua++ stable (in the forked version that I just posted, anyway). Some
of the tolua++ code is ... sub-optimal, to say the least. I'm finding
pretty straightforward optimizations I can make in the few places I've
looked. :/

I'll likely throw most of it out and do my own wrapper for the next
project, but I have a project to complete. :)

> Advantages:
> - Everything looks like 'normal' Lua bindings. No need to learn two
> different style interfaces for doing bindings.

I like this idea for the low level interface, but I want to tack a
higher-level specification language on top of it. While I am capable of
using Lua bindings directly, I'd much rather say "export this function
with this call signature to Lua" and be done. I think the code
generation path is for me, driving push_xxx/to_xxx-style functions.

> - Small.
> - Fast.

Key features, for sure. :)

> Disadvantages:
> - More verbose code.
> - Harder to learn for C++ coders who don't know the Lua stack, and are
> more used to working with classes and templates.

Both of these are drawbacks for me that would kill that as a complete
solution. I want my API to be accessible and easy to use, and while my
own experience includes writing assembly language and so thinking in
terms of a stack is second nature, I don't want to assume everyone who
uses my library will have those skills.

It's also easy to make a mistake that causes an obscure crash; there's a
reason I don't program in assembly language any more, after all. :)

> I'm sure some other wrappers also have some of the advantages above, I
> haven't looked at everything in depth, and it was some time ago. I'm
> pretty happy with how it turned out, though.

Glad that worked for you. After this project I'll probably head down a
similar path to start with, and then figure out how to wrap it up and
make it pretty. :)

Tim
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJNEQkMAAoJENSbqLBCyKKsQy4H/3SyXTz68f5ADJT6pr3nl8S4
QtdaajB2qHl0jkI1VBrmW5dH/6cWf5eY9eUmZVH+9ThSUBGK4qRnioXFGLFSzWxA
959pLQBH8UzipdlOuu3TjT42391N1RWJx0TbVUPK7GnMCxG/7RY8Zx1aC3Y61sgd
t5jxgz80bDrc0fEMRUSwAyPoPlySDPl6Hom4vH3SeV/9liDPipYeR+bZebixI9dk
sInhoJDqvA8ZL0y55/wujiLVDJ/uEZOSlTWy7gl/qvzKmGbZ78aGmFqLXDK0SVod
qSr+Vq0y42gNjZKVN+HXVwxTnFYypDetugZEdRQ0jOfJpyzLgq5HtS1irzIk6Ic=
=orIs
-----END PGP SIGNATURE-----