Hi,
I’ve got a problem regarding passing information to lua functions from c++ when doing executeCallFunc*
.
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();
tempNode->setUserData((void*)notificationLayer->getString().c_str());
CCScriptEngineManager::sharedScriptEngineManager()->getScriptEngine()->executeCallFuncN(functionNameOk.c_str(), tempNode);
and in Lua:
function testString(node)
ogsLog("node:", node)
ogsLog("wooohoooo string passed!", node:getUserData())
end
I get:
Cocos2d: node: userdata: 0xeb49e94
Cocos2d: wooohoooo string passed! userdata: 0xeb40e8c
Damn
I would appreciate if someone could point me in right direction I’m sure I’m missing something obvious.