Skip to content

Conversation

@Alexander-L-Robert
Copy link

@Alexander-L-Robert Alexander-L-Robert commented Dec 18, 2025

Felt like tableext should have a toset util.

I reordered tableext methods to group dictionary and array methods more distinctly
(keys and toset are the boundary as they convert between the two table formats)

This repo seems to avoid comments where possible so I left out labeling those sections.

EDIT: I'm now realizing there's no ideal way to do this. The current implementation of toset of an array of numbers can create sparse arrays.

We could possibly:

  • expect users to treat this like a dictionary, even if it creates a sparse array.
  • use tostring() to convert to string keys and not support tables. Update the signature to only allow primitive types that can be converted via tostring().
  • create an object that would store the original type of the list then when trying to access the key, it would convert the key back to that type for its metaproperties like __pair.
    • to support tables, it would have to deep compare so identical tables with different pointers could still index the same key. Maybe add an optional arg that would allow for a custom comparison function for tables this if that's the original list's value type.

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