Getting rid of Angelscript prints

Started by
2 comments, last by WitchLord 10 years, 5 months ago

Hello!

I want to do my own error handling for when Angelscript functions fail. In most cases this is really easy by just checking the return value. However it seems like there is one case where I am getting an error print from Angelscript when I would rather want to take care of it myself. Here is the code in question:


asIObjectType* ScriptModule::getObjectTypeByDecl(const std::string& decl)
{
    std::cout << "Type declaration: " << decl << "\n";
    auto id = mAsModule->GetTypeIdByDecl(decl.c_str());
    std::cout << "Id: " << id << "\n";


    if(id < 0)
    {   
        std::cout << "Returning null!\n";
        return nullptr;
    }   


    auto thing = mEngine.getEngine()->GetObjectTypeById(id);
    std::cout << "Thing is: " << thing << "\n";


    return thing;
}

If I provide this function with a type that does not exist, "Elphant" instead of "Elephant" for instance, I get the following output:


Type declaration: Elphant
 (1, 1) : error : Identifier 'Elphant' is not a data type
Id: -12
Returning null!

So it seems like everything works as expected, except that the function not only returns -12 as the error, but also gives this debug print which is unwanted. Is there a particular reason for this? Am I doing it the wrong way? If not, can I get rid of the print somehow?

Advertisement
This is a mistake. The library should not write any message to the application in this case. I'll have it fixed as soon as I can.

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

Ah, alright. Take your time. :)

I've corrected this mistake in revision 1761.

Thanks,

Andreas

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

This topic is closed to new replies.

Advertisement