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.

@Alexander-L-Robert Alexander-L-Robert changed the title Tableext toset Add tableext.toset Dec 18, 2025
@Alexander-L-Robert Alexander-L-Robert changed the title Add tableext.toset Add tableext.toset Dec 18, 2025
Comment on lines +79 to +87
local foundKeys: { number } = {}
for key, value in setA do
assert.eq(value, true)
table.insert(foundKeys, key)
end
assert.eq(#foundKeys, setSize)
assert.eq(setA[foundKeys[1]], true)
assert.eq(setA[foundKeys[2]], true)
assert.eq(setA[foundKeys[3]], true)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sanity check to verify that sets created using an array of numbers doesn't break from having gaps between the number keys.

This repo seems to avoid comments where possible so I left this comment out of code but can add if you think it's appropriate.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can author comments that explain why things are the way they are. There's no desire or commitment to avoiding comments in general, though I would probably tell people to omit comments that are just a direct explanation of the code that immediately follows it since those kinds of comments get stale all the time and add very little value. Explanations of why are great, high-level descriptions of overarching decisions that affect everything that follows are great, etc.

@Alexander-L-Robert Alexander-L-Robert marked this pull request as ready for review December 18, 2025 19:20
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.

2 participants