I'm new to Lua and during the last week I've delved into the language and the libraries that bind C++ classes and functions to Lua.
Right now I'm successfully using tolua++ 1.0.93 with Lua 5.1.
Scripts like this work flawlessly:
c = Class:new()
print("LUA: Num is "..c:getNum())
c:setNum(DEFINED_VAR)
But this kind of script is not what I need. I want to be able to pass a pointer to Class from inside the C++ code to a Lua function defined in the script and call Class' functions there, effectively manipulating the passed object.
I've searched a lot about how it should be done, but I'm still confused. As I'm using tolua I suppose I should use tolua_pushusertype to pass the pointer to the object to Lua. But I cannot understand how can I use the passed object's functions.
Tell me please what should I do to get the result I want? Any tips will be appreciated as I'm pretty tired from not being able to solve this problem on my own.
-upd-
Fixed Lua capitalization, thanks to dmail.