Game Screeps - Using the lodash module

screeps

Solution

When using the lodash module, it's necessary to require it into a var like below in the beggining of the module and then it should work:

var _ = require('lodash');

Problem

I'm playing Screeps (http://screeps.com) and I'm trying to use the lodash module for filtering my harvesters from the rest of the creeps. The code below should work but when I run it I get a `ReferenceError: _ is not defined at <main>:6:18`. Any idea of what's wrong? ``` var harvesters = _.filter(Game.creeps, {memory: 'harvester'}); if(_.size(harvesters) < 3 && Memory.creep_queue.length===0) { Memory.creep_queue.push('harvester') } ```

Original source