Navigation

    forum

    • Login
    • Search
    • Categories
    • Recent
    • Popular
    • Users
    • Groups
    1. Home
    2. Adil
    • Flag Profile
    • block_user
    • Profile
    • Following
    • Followers
    • Topics
    • Posts
    • Groups
    • Blog

    Adil

    @Adil

    2
    Posts
    657
    Profile views
    0
    Followers
    0
    Following
    Joined Last Online

    Adil Follow

    Posts made by Adil

    • RE: What's wrong with reference storage.
      can't store objects' references into Memory, the result is "undefined behavior"

      Well, yes, that's what I reported as a bug.

      In certain other languages (can't say about other js execution environments) such reference juggling is a natural thing to do and helps performance.

      Maybe this limitation should be highlighted somewhere in tutorial. On that documentation page it slips by in the load of obvious or alternatively highly special technicalities.

      posted in Help
      Adil
    • What's wrong with reference storage.

      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)

      posted in Help
      Adil