lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

> I have a variable that contains numeric values separated by a comma, e.g.
> Values = "1, 7, 5". I want to figure out which value within that variable is
> the lowest and highest. The math.min and math.max functions seem most
> appropriate except that they wont accept a variable as an argument. Is this
> possible with the built in math functions or do I need to parse the variable
> and compare values with tonumber()?

min,max = loadstring("return math.min("..Values.."), math.max("..Values..")")()