I’ve got a problem regarding passing information to lua functions from c++ when doing
It’s all fine when I have to pass integers, as I can use CCNode and tag for example.
The trouble starts when I have to pass a string for example.
So I’ve tried using userData on CCNode to pass this information [that’s a hack, I know, but I couldn’t find any other way to do so], but all I get in Lua is userdata :/
CCNode *tempNode = CCNode::node();
and in Lua:
ogsLog("wooohoooo string passed!", node:getUserData())
Cocos2d: node: userdata: 0xeb49e94
Cocos2d: wooohoooo string passed! userdata: 0xeb40e8c
I would appreciate if someone could point me in right direction :/ I’m sure I’m missing something obvious.
Is there a way to pass some data from c*+ to the lua script?
For example, there is a object in c*+ named SomeDataForLua with int fields someData1 and someData2.
Is it possible to send this to the lua script from c++?