I think the problem I want to solve will an easy one for most of you:)
Suppose I have a class Node which has a member function setPosition(float x, float y, float z). I would like to be able to define a variable of class Node in lua and then be able to use setPosition() function also form the Lua.
I know that there are issues that Lua is rather for C not C++ and has its issues with C++ classes but I also know that it is achievable.
I think the problem I want to solve will an easy one for most
Share
I’d use Luabind for this. With it you can easily bind C++ classes so they can be created, accessed, and modified in Lua. The code you’d write in C++ might look roughly like this:
Then you’d be able to say this in Lua:
You could also make bindings so that the Lua looks a little more natural and could support things like these: