-
Notifications
You must be signed in to change notification settings - Fork 32
Add tableext.toset
#699
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: primary
Are you sure you want to change the base?
Add tableext.toset
#699
Conversation
…istinctly (keys and toset are the boundary as they're adapter functions that switch between the two table formats)
| 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) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
Felt like tableext should have a
tosetutil.