MinValue / MaxValue


Returns the minimum or maximum numeric or alphabetical value of a set.

This must be used as an Inline Lua section variable, and can be used anywhere that section variables are allowed. Ensure that DynamicVariables=1 is used on any measures or meters using Inline Lua.

Pass as many comma separated numeric or string values as desired to the function. These can also be [#Variables] or [&SectionVariables].

Examples:

MinValue(3,29,58,17,4)
MaxValue(3,29,58,17,4)
MinValue('Juliett','Sierra','Bravo','Victor','Lima')

[MeterMax]
Meter=String
Text=[&LuaMeasure:MaxValue(3,29,58,17,4)]
DynamicVariables=1

Lua Code:

function MinValue(...)

valueTable = {}

for i = 1, #arg do
table.insert(valueTable, arg[i])
end

table.sort(valueTable, function(a,b) return a<b end)

return valueTable[1]

end

function MaxValue(...)

valueTable = {}

for i = 1, #arg do
table.insert(valueTable, arg[i])
end

table.sort(valueTable, function(a,b) return a>b end)

return valueTable[1]

end