Sign in to follow this  

best way to integrate Lua with c++

Recommended Posts

Currently I'm experimenting with Lunar ( to bind my C++ classes to Lua. It uses a simple template to allow you to choose which member functions to expose, and allows you to choose the 'class name' which is used in Lua. After registering the class with Lua, you can then do things in Lua like:

MyButton = Button("Test",x,y,width,height)

function Button:OnAction()
printf("User clicked button %s", self.GetCaption())

Most likely, you'd want to write a wrapper-class which acts as an interface between Lua and the actual instance of your class.

Share this post

Link to post
Share on other sites
LuaPlus + LuaBind.

- Clean binding from script->C++ (including oop)
- pretty crash-resistant

- Unicode
- Script debugging marginally easier from plugins
- handles all the messy stack-handling stuff

Wouldn't go back to pure LUA for love or money.


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