Skip to content

Add instanceIndex alias for instanceID#8912

Open
aashu2006 wants to merge 3 commits into
processing:mainfrom
aashu2006:instance-index-alias
Open

Add instanceIndex alias for instanceID#8912
aashu2006 wants to merge 3 commits into
processing:mainfrom
aashu2006:instance-index-alias

Conversation

@aashu2006

@aashu2006 aashu2006 commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Addresses #8911

Changes

  • Add instanceIndex as a value-based API for accessing the current instance index in p5.strands
  • Preserve instanceID() for backwards compatibility
  • Update docs and examples to use instanceIndex as the preferred API
  • Update WebGL and WebGPU tests to use instanceIndex

instanceIndex is exposed as a property rather than a function, making it feel more consistent with other strands values such as width, height, and mouseX. The existing instanceID() API remains available for compatibility.

PR Checklist

  • npm run lint passes
  • Inline reference is included / updated
  • Unit tests are included / updated

@aashu2006

Copy link
Copy Markdown
Contributor Author

@davepagurek I have updated it based on the discussion around instanceIndex.

instanceIndex is now exposed as a value instead of a function, while instanceID() remains unchanged for compatibility. The implementation uses a dedicated property accessor that creates the same underlying node as instanceID(), and docs/examples have been updated to use the value-based API.

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