[LUA]Getting most recurring integer in a table
up vote
1
down vote
favorite
i need to get the most recurring vIndex
in a lua table structured like this:
{{id=0, vIndex = 0},{id=34, vIndex = 1},...}
what's the best way to do so?
sorting lua lua-table
add a comment |
up vote
1
down vote
favorite
i need to get the most recurring vIndex
in a lua table structured like this:
{{id=0, vIndex = 0},{id=34, vIndex = 1},...}
what's the best way to do so?
sorting lua lua-table
add a comment |
up vote
1
down vote
favorite
up vote
1
down vote
favorite
i need to get the most recurring vIndex
in a lua table structured like this:
{{id=0, vIndex = 0},{id=34, vIndex = 1},...}
what's the best way to do so?
sorting lua lua-table
i need to get the most recurring vIndex
in a lua table structured like this:
{{id=0, vIndex = 0},{id=34, vIndex = 1},...}
what's the best way to do so?
sorting lua lua-table
sorting lua lua-table
asked Nov 10 at 19:08
Terku Official Channel
82
82
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
1
down vote
accepted
Loop over each element in a table and keep track on the number of occurrences in another table where each value of vIndex
being a key. Then loop over the second table to find the element with the max value. This will be your most frequent vIndex
.
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
accepted
Loop over each element in a table and keep track on the number of occurrences in another table where each value of vIndex
being a key. Then loop over the second table to find the element with the max value. This will be your most frequent vIndex
.
add a comment |
up vote
1
down vote
accepted
Loop over each element in a table and keep track on the number of occurrences in another table where each value of vIndex
being a key. Then loop over the second table to find the element with the max value. This will be your most frequent vIndex
.
add a comment |
up vote
1
down vote
accepted
up vote
1
down vote
accepted
Loop over each element in a table and keep track on the number of occurrences in another table where each value of vIndex
being a key. Then loop over the second table to find the element with the max value. This will be your most frequent vIndex
.
Loop over each element in a table and keep track on the number of occurrences in another table where each value of vIndex
being a key. Then loop over the second table to find the element with the max value. This will be your most frequent vIndex
.
answered Nov 10 at 20:55
Paul Kulchenko
19k22539
19k22539
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53242466%2fluagetting-most-recurring-integer-in-a-table%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown