Circular references



  • Hi again,

    Just wondering how do you deal with circular references with include files in screeps/javascript (google hasn't helped)

    example in file main.workforce:

    var creepScout = require('creep.scout');

    and in file creep,scout:

    var workforce = require('main.workforce');

    basically in creep.scout i want to call a function defined in main.workforce but main.workforce already owns (and should own) creep.scout.

    Thanks,

    Primoz


  • YP

    I don't. In such cases I usually have a third file that imports the other two ,)