Sign in to follow this  

ELuna(a new project to bind C/C++ and Lua)

Recommended Posts

[b] ELuna - Extended Luna[/b]

ELuna is a simple library to bind C/C++ and Lua, which just depends on Lua library. It is clear and light. You can include ELuna and Lua in your project to use. My original intention is to do some extension for Luna, so its main idea bases on luna. Users don't have to focus on the details of binding C++ and Lua, but use some simple API provided by ELuna to bind cpp class, method, function or to bind lua function, table.

Before version 1.1, ELuna copied class's all methods to object's table when you create an object, that is the same as Luna. It needn't find method from metatable when you call cpp method, but object creation is very slow. Obviously, this way may be a good chiose when you call its method many times but create object rarely. In order to improve its efficiency, I do some adjustments in later versions. I use a new way to bind method which doesn't copy class's all methods to table, but register a method to class's metatable. When you call this method, ELuna will find this method from metatable by using "index" metamethod. In this way, object creation is very fast while calling method is a little slower than before. Finally, how to choose the version depends on your requirement.

After many versions, ELuna has been stable at present. However, maybe there are still some bugs that I didn't find. Please contact me when you find any problems. Of course, ELuna also can't support all the features, such as binding member data and so on. The main reason is that they were either used rarely or implemented easily by other ways during my past project. For example, we can register a "get" and "set" method to take the place of binding the member data. If you really need these features, it is simple to add by yourself.

Thank you for your support!
[size="-1"]Project Home page?[/size][url=""][/url]

Share this post

Link to post
Share on other sites
[quote name='DoctorGlow' timestamp='1340996509' post='4954037']
How does your library differ from luabind?
Luabind is a nice library, but it's also a huge library, and dependents on boost. Eluna is simple and light library, and doesn't dependents on other library. Besides, Eluna is more faster than Luabind, but it doesn't support all features.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this