These are chat archives for ChaiScript/ChaiScript

22nd
Oct 2016
Daniel Guzman
@roig
Oct 22 2016 15:35

Hello @lefticus , are the type_conversions to bool working when used inside an if ( .. ), like this:

class PlayerPrototype2 {
    var e;
    def PlayerPrototype2() {

    }

    def awake() {
        this.e = edv_getGameEntity(this);
    }

    def fixedUpdate() {
        // This is working ok
        if ( this.e.isValid() ) 
        {
            print("it's ok! 1");
        }

        // This is giving :
        // Error: "Condition not boolean" during evaluation at (PlayerPrototype2.chai 21, 8)
        if ( this.e ) 
        {
            print("it's ok! 2 ");
        }
    }
}

And in C++ I'm doing:

    module->add(chaiscript::type_conversion<edv::GameEntity, bool>());
I'm getting this error: "Condition not boolean" mmm...