当前位置: 首页>>代码示例>>C++>>正文


C++ CCLuaStack::clean方法代码示例

本文整理汇总了C++中CCLuaStack::clean方法的典型用法代码示例。如果您正苦于以下问题:C++ CCLuaStack::clean方法的具体用法?C++ CCLuaStack::clean怎么用?C++ CCLuaStack::clean使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CCLuaStack的用法示例。


在下文中一共展示了CCLuaStack::clean方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: malloc

cocos2d::LUA_STRING CCCrypto::cryptAES256Lua(bool isDecrypt,
                                             const char* input,
                                             int inputLength,
                                             const char* key,
                                             int keyLength)
{
    CCLuaStack* stack = CCLuaEngine::defaultEngine()->getLuaStack();
    stack->clean();
    if (getAES256KeyLength() == 0)
    {
        stack->pushNil();
        return 1;
    }
    
    int bufferSize = inputLength + getAES256KeyLength();
    void* buffer = malloc(bufferSize);
    int dataUsed = cryptAES256(isDecrypt, (unsigned char*)input, inputLength, (unsigned char*)buffer, bufferSize, (unsigned char*)key, keyLength);
    if (dataUsed > 0)
    {
        stack->pushString(static_cast<const char*>(buffer), dataUsed);
    }
    else
    {
        stack->pushNil();
    }
    free(buffer);
    return 1;
}
开发者ID:joshfeng,项目名称:quick-cocos2d-x,代码行数:28,代码来源:CCCrypto.cpp

示例2: free

LUA_STRING CCCrypto::encodingBase64Lua(bool isDecoding,
                                       const char* input,
                                       int inputLength)
{
    CCLuaStack* stack = CCLuaEngine::defaultEngine()->getLuaStack();
    stack->clean();

    int bufferSize = isDecoding ? Base64decode_len(input) : Base64encode_len(inputLength);
    char *buffer = bufferSize ? (char*)malloc(bufferSize) : NULL;
    int size = 0;

    if (buffer)
    {
        size = isDecoding ? Base64decode(buffer, input) : (Base64encode(buffer, input, inputLength) - 1);
    }
    if (size)
    {
        stack->pushString(buffer, size);
    }
    else
    {
        stack->pushNil();
    }
    if (buffer)
    {
        free(buffer);
    }
    return 1;
}
开发者ID:1085075003,项目名称:quick-cocos2d-x,代码行数:29,代码来源:CCCrypto.cpp

示例3: free

LUA_STRING CCCrypto::encodingBase64Lua(bool isDecoding,
                                       const char* input,
                                       int inputLength)
{
    CCLuaStack* stack = CCLuaEngine::defaultEngine()->getLuaStack();
    stack->clean();
    
    int outputLength = inputLength * 2;
    char* output = static_cast<char*>(malloc(outputLength));
    int dataUsed = -1;
    
    if (isDecoding)
    {
        dataUsed = decodeBase64(input, output, outputLength);
    }
    else
    {
        dataUsed = encodeBase64((unsigned char*)input, inputLength, output, outputLength);
    }
    if (dataUsed > 0 && dataUsed < outputLength)
    {
        stack->pushString(output, dataUsed);
    }
    else
    {
        stack->pushNil();
    }
    free(output);
    return 1;
}
开发者ID:joshfeng,项目名称:quick-cocos2d-x,代码行数:30,代码来源:CCCrypto.cpp

示例4: SendBinaryMessageToLua

static int SendBinaryMessageToLua(int nHandler,const unsigned char* pTable,int nLength)
{
    if (NULL == pTable || nHandler <= 0) {
        return 0;
    }
    
    if (NULL == CCScriptEngineManager::sharedManager()->getScriptEngine()) {
        return 0;
    }
    
    CCLuaStack *pStack = CCLuaEngine::defaultEngine()->getLuaStack();
    if (NULL == pStack) {
        return 0;
    }

    lua_State *tolua_s = pStack->getLuaState();
    if (NULL == tolua_s) {
        return 0;
    }
    
    int nRet = 0;
    CCLuaValueArray array;
    for (int i = 0 ; i < nLength; i++) {
        CCLuaValue value = CCLuaValue::intValue(pTable[i]);
        array.push_back(value);
    }
    
    pStack->pushCCLuaValueArray(array);
    nRet = pStack->executeFunctionByHandler(nHandler, 1);
    pStack->clean();
    return nRet;
}
开发者ID:13609594236,项目名称:quick-cocos2d-x,代码行数:32,代码来源:Lua_web_socket.cpp

示例5: getResponseDataLua

LUA_STRING CCHTTPRequest::getResponseDataLua(void)
{
    CCAssert(m_state == kCCHTTPRequestStateCompleted, "CCHTTPRequest::getResponseDataLua() - request not completed");
    CCLuaStack *stack = CCLuaEngine::defaultEngine()->getLuaStack();
    stack->clean();
    stack->pushString(static_cast<char*>(m_responseBuffer), (int)m_responseDataLength);
    return 1;
}
开发者ID:yinjimmy,项目名称:qmm,代码行数:8,代码来源:CCHTTPRequest.cpp

示例6: addArmatureFileInfoAsyncCallback

void LuaArmatureWrapper::addArmatureFileInfoAsyncCallback(float percent)
{
    if (0 != m_lHandler)
    {
        CCLuaEngine* pEngine = CCLuaEngine::defaultEngine();
        CCLuaStack* pStack = pEngine->getLuaStack();
        
        pStack->pushFloat(percent);
        pStack->executeFunctionByHandler(m_lHandler, 1);
        pStack->clean();
    }
}
开发者ID:237676098,项目名称:quick-cocos2d-x,代码行数:12,代码来源:lua_cocos2dx_cocostudio_manual.cpp

示例7: eventCallbackFunc

void LuaCocoStudioEventListener::eventCallbackFunc(CCObject* sender,int eventType)
{
    if (0 != m_lHandler)
    {
        CCLuaEngine* pEngine = CCLuaEngine::defaultEngine();
        CCLuaStack* pStack = pEngine->getLuaStack();
        pStack->pushCCObject(sender, "CCObject");
        pStack->pushInt(eventType);
        pStack->executeFunctionByHandler(m_lHandler, 2);
        pStack->clean();
    }
}
开发者ID:fordream,项目名称:quick,代码行数:12,代码来源:lua_cocos2dx_cocostudio_manual.cpp

示例8: getFileData

int CZHelperFunc::getFileData(const char *pPathFile)
{
    unsigned long size;
    unsigned char* buf = CZHelperFunc::getFileData(pPathFile, "rb", &size);
    if (NULL==buf) return 0;
    
    CCLuaStack* stack = CCLuaEngine::defaultEngine()->getLuaStack();
	stack->clean();
    stack->pushString((const char*)(buf), size);
    delete buf;
    return 1;
}
开发者ID:109383670,项目名称:quick-cocos2d-x,代码行数:12,代码来源:HelperFunc.cpp

示例9: ret

const string CCCrypto::MD5String(void* input, int inputLength)
{
    unsigned char buffer[MD5_BUFFER_LENGTH];
    MD5(static_cast<void*>(input), inputLength, buffer);

    CCLuaStack* stack = CCLuaEngine::defaultEngine()->getLuaStack();
    stack->clean();

    char* hex = bin2hex(buffer, MD5_BUFFER_LENGTH);
    string ret(hex);
    delete[] hex;
    return ret;
}
开发者ID:1085075003,项目名称:quick-cocos2d-x,代码行数:13,代码来源:CCCrypto.cpp

示例10: executeTouchBeganHandler

CWidgetTouchModel CWidget::executeTouchBeganHandler(CCTouch* pTouch)
{
	m_bTouchInterrupt = false;

    if( m_pTouchBeganListener && m_pTouchBeganHandler )
    {
		CWidgetTouchModel eUserTouchModel = (m_pTouchBeganListener->*m_pTouchBeganHandler)(m_pThisObject, pTouch);
		if( eUserTouchModel == eWidgetTouchNone )
		{
			return eWidgetTouchNone;
		}
		else
		{
			this->onTouchBegan(pTouch);
			return eUserTouchModel;
		}
    }
#if USING_LUA
	else if( m_nTouchBeganScriptHandler != 0 )
	{
		CCLuaEngine* pEngine = CCLuaEngine::defaultEngine();
		CCLuaStack* pStack = pEngine->getLuaStack();

		pStack->pushCCObject(m_pThisObject, "CCObject");
		pStack->pushCCObject(pTouch, "CCTouch");
		
		CCArray* pRetArray = new CCArray();
		pRetArray->initWithCapacity(1);

		int nRet = pStack->executeFunctionReturnArray(m_nTouchBeganScriptHandler, 2, 1, pRetArray);
		CCAssert(pRetArray->count() > 0, "return count = 0");

		CCDouble* pIntModel = (CCDouble*) pRetArray->objectAtIndex(0);
		CWidgetTouchModel eUserTouchModel = (CWidgetTouchModel) ( (int)pIntModel->getValue() );
		delete pRetArray;
		pStack->clean();

		if( eUserTouchModel == eWidgetTouchNone )
		{
			return eWidgetTouchNone;
		}
		else
		{
			this->onTouchBegan(pTouch);
			return eUserTouchModel;
		}
	}
#endif
    return this->onTouchBegan(pTouch);
}
开发者ID:cl0uddajka,项目名称:cocoswidget,代码行数:50,代码来源:Widget.cpp

示例11:

LUA_STRING CCCrypto::MD5FileLua(const char* path)
{
    unsigned char buffer[MD5_BUFFER_LENGTH];
    MD5File(path, buffer);
    
    CCLuaStack* stack = CCLuaEngine::defaultEngine()->getLuaStack();
    stack->clean();
    
    char* hex = bin2hex(buffer, MD5_BUFFER_LENGTH);
    stack->pushString(hex);
    delete[] hex;
    
    return 1;
}
开发者ID:1085075003,项目名称:quick-cocos2d-x,代码行数:14,代码来源:CCCrypto.cpp

示例12: movementEventCallback

void LuaArmatureWrapper::movementEventCallback(CCArmature* armature, MovementEventType type,const char* movementID)
{
    if (0 != m_lHandler)
    {
        CCLuaEngine* pEngine = CCLuaEngine::defaultEngine();
        CCLuaStack* pStack = pEngine->getLuaStack();
        
        pStack->pushCCObject(armature, "CCArmature");
        pStack->pushInt(type);
        pStack->pushString(movementID);
        pStack->executeFunctionByHandler(m_lHandler, 3);
        pStack->clean();
    }
}
开发者ID:237676098,项目名称:quick-cocos2d-x,代码行数:14,代码来源:lua_cocos2dx_cocostudio_manual.cpp

示例13: getFileDataOrder

void CCZipFile::getFileDataOrder(const char *filename)
{
    unsigned long size;
    unsigned char* buf = getFileData(filename, &size);
	CCLuaStack* stack = CCLuaEngine::defaultEngine()->getLuaStack();
	stack->clean();
	if (NULL==buf) 
	{
		stack->pushNil();
		return;
	}
    stack->pushString((const char*)buf, size);
    delete []buf;
    return;   
}
开发者ID:gooderman,项目名称:vv2d,代码行数:15,代码来源:CCZipFile.cpp

示例14: frameEventCallback

void LuaArmatureWrapper::frameEventCallback(CCBone* bone, const char* frameEventName, int orginFrameIndex, int currentFrameIndex)
{
    if (0 != m_lHandler)
    {
        CCLuaEngine* pEngine = CCLuaEngine::defaultEngine();
        CCLuaStack* pStack = pEngine->getLuaStack();
        
        pStack->pushCCObject(bone, "CCBone");
        pStack->pushString(frameEventName);
        pStack->pushInt(orginFrameIndex);
        pStack->pushInt(currentFrameIndex);
        pStack->executeFunctionByHandler(m_lHandler, 4);
        pStack->clean();
    }
}
开发者ID:237676098,项目名称:quick-cocos2d-x,代码行数:15,代码来源:lua_cocos2dx_cocostudio_manual.cpp

示例15: getFileList

void CCZipFile::getFileList()
{
	if(!m_hasGenFlist)
	{
		genFileList();
	}
    CCLuaValueArray array;
	for(auto a:m_fileList)
	{
        CCLuaValue value = CCLuaValue::stringValue(a.first);
        array.push_back(value);
    }    
    CCLuaStack* stack = CCLuaEngine::defaultEngine()->getLuaStack();
    stack->clean();
    stack->pushCCLuaValueArray(array);
	return;
}
开发者ID:gooderman,项目名称:vv2d,代码行数:17,代码来源:CCZipFile.cpp


注:本文中的CCLuaStack::clean方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。