void LuaStack::pushLuaValue(const LuaValue& value) { const LuaValueType type = value.getType(); if (type == LuaValueTypeInt) { return pushInt(value.intValue()); } else if (type == LuaValueTypeFloat) { return pushFloat(value.floatValue()); } else if (type == LuaValueTypeBoolean) { return pushBoolean(value.booleanValue()); } else if (type == LuaValueTypeString) { return pushString(value.stringValue().c_str()); } else if (type == LuaValueTypeDict) { pushLuaValueDict(value.dictValue()); } else if (type == LuaValueTypeArray) { pushLuaValueArray(value.arrayValue()); } else if (type == LuaValueTypeObject) { pushObject(value.ccobjectValue(), value.getObjectTypename().c_str()); } }
void NBGNetManager::onResponse(void* pLuaValueDict) { if (luaHandler_onResponse > 0) { auto engine = LuaEngine::getInstance(); auto stack = engine->getLuaStack(); auto responseData = (LuaValueDict*)pLuaValueDict; stack->pushLuaValueDict(*responseData); stack->executeFunctionByHandler(luaHandler_onResponse, 1); stack->clean(); } }