Skip to content

table:max-value and table:max-key to get the maximum value and key of the maximum value from a table #15

@EwoutH

Description

@EwoutH

It would be very useful to have to functions, let's say table:max-value and table:max-key, which giver the maximum value in a table and the key corresponding to that value.

For example, given the following table:

let fruit table:make
table:put fruit "apple" 2
table:put fruit "orange" 5
table:put fruit "banana" 3

table:max-value fruit would give 5, while table:max-key fruit would give "orange".

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions