Example #1
0
int CCLuaEngine::pushCCScriptValueToLuaStack(const CCScriptValue& value)
{
    const CCScriptValueType type = value.getType();
    if (type == CCScriptValueTypeInt)
    {
        return pushIntegerToLuaStack(value.intValue());
    }
    else if (type == CCScriptValueTypeFloat)
    {
        return pushFloatToLuaStack(value.floatValue());
    }
    else if (type == CCScriptValueTypeBoolean)
    {
        return pushBooleanToLuaStack(value.booleanValue());
    }
    else if (type == CCScriptValueTypeString)
    {
        return pushStringToLuaStack(value.stringValue().c_str());
    }
    else if (type == CCScriptValueTypeDict)
    {
        pushCCScriptValueDictToLuaStack(value.dictValue());
    }
    else if (type == CCScriptValueTypeArray)
    {
        pushCCScriptValueArrayToLuaStack(value.arrayValue());
    }
    else if (type == CCScriptValueTypeCCObject)
    {
        pushCCObjectToLuaStack(value.ccobjectValue(), value.getCCObjectTypename().c_str());
    }
    
    return lua_gettop(m_state);
}
Example #2
0
int CCLuaEngine::pushCCLuaValueToLuaStack(CCLuaValue* pValue)
{
    CCLuaValueType type = pValue->getType();
    if (type == CCLuaValueTypeInt)
    {
        return pushIntegerToLuaStack(pValue->getIntValue());
    }
    else if (type == CCLuaValueTypeFloat)
    {
        return pushFloatToLuaStack(pValue->getFloatValue());
    }
    else if (type == CCLuaValueTypeBoolean)
    {
        return pushBooleanToLuaStack(pValue->getBooleanValue());
    }
    else if (type == CCLuaValueTypeString)
    {
        return pushStringToLuaStack(pValue->getStringValue().c_str());
    }
    else if (type == CCLuaValueTypeCCLuaTableDict)
    {
        pushCCLuaTableDictToLuaStack(pValue->getTableDictValue());
    }
    else if (type == CCLuaValueTypeCCLuaTableArray)
    {
        pushCCLuaTableArrayToLuaStack(pValue->getTableArrayValue());
    }
    
    return lua_gettop(m_state);
}