Skip to content

🔨 Fix Array prototype extensions breaking construction site placement at the edges#155

Open
tiennou wants to merge 1 commit intoscreeps:masterfrom
tiennou:fix/array-prototype-changes-break-iteration
Open

🔨 Fix Array prototype extensions breaking construction site placement at the edges#155
tiennou wants to merge 1 commit intoscreeps:masterfrom
tiennou:fix/array-prototype-changes-break-iteration

Conversation

@tiennou
Copy link
Copy Markdown
Contributor

@tiennou tiennou commented Apr 26, 2026

If you add something like

Array.prototype.last = function() {
  return this[this.length - 1];
}

to your bot to get additional methods on array, this piece of code ends up breaking, as the for…in loop will try running over that last key and break the check. Fix the issue by using a proper for…of loop.

Ref #126

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant