Skip to content
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

MapTableBySubfield - New Shared Function #1042

Closed
wants to merge 2 commits into from

Conversation

AnishBplayz
Copy link
Contributor

The Lua function QBShared.MapTableBySubfield takes two parameters: subfield and table. It maps the input table based on the specified subfield, creating a new table (mappedTable) where each unique value of the subfield corresponds to a subtable containing all entries with that value. The function iterates through the input table, checks for the existence of the subfield in each entry, and creates subtables in mappedTable accordingly. Entries are then appended to their respective subtables. While the use of the goto statement for skipping iterations is unconventional, it efficiently skips to the next iteration when the subfield is absent. The resulting mappedTable is returned as the output.

The Lua function `QBShared.MapTableBySubfield` takes two parameters: `subfield` and `table`. It maps the input table based on the specified subfield, creating a new table (`mappedTable`) where each unique value of the subfield corresponds to a subtable containing all entries with that value. The function iterates through the input table, checks for the existence of the subfield in each entry, and creates subtables in `mappedTable` accordingly. Entries are then appended to their respective subtables. While the use of the `goto` statement for skipping iterations is unconventional, it efficiently skips to the next iteration when the subfield is absent. The resulting `mappedTable` is returned as the output.
Copy link

github-actions bot commented Feb 6, 2024

This PR has had 60 days of inactivity & will close within 7 days

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

Successfully merging this pull request may close these issues.

1 participant