Browser version.
The following code:
Memory.spa=Game.spawns.Spawn1
module.exports.loop = function () {
console.log(Memory.spa.name)
console.log(Memory.spa.createCreep)
}
Genetates this output
[8:26:37 PM]Spawn1
[8:26:37 PM]undefined
[8:26:38 PM]Spawn1
[8:26:38 PM]undefined
[8:26:39 PM]Spawn1
[8:26:39 PM]function (b,c,e){var f=this;p.isObject(c)&&p.isUndefined(e)&&(e=c,c=void 0);var g=this.canCreateCreep(b,c);return g!=o.OK?g:(c||(c=a("./names").getUniqueName(function(a){return p.any(h.roomObjects,{type:"creep",user:d(f.id).user,name:a})||-1!=l.indexOf(a)})),l.push(c),p.isUndefined(k.Memory.creeps)&&(k.Memory.creeps={}),p.isObject(k.Memory.creeps)&&(p.isUndefined(e)?k.Memory.creeps[c]=k.Memory.creeps[c]||{}:k.Memory.creeps[c]=e),i.set(this.id,"createCreep",{name:c,body:b}),c)}
[8:26:40 PM]Spawn1
[8:26:40 PM]undefined
Most of the time, class information about the object is lost.
Can the script engine store references to functions and objects or not?
(Also, this forum reacts strangely to ctrl+v)