Published Oct 13, 2023Updated Oct 28, 2023
Contribute to Docs

In Lua, the math.min() function is used to return the smallest value from a series of one or more numbers.


  • values (required): The series of numbers to return the smallest value from. These numbers can be positive or negative. The function also takes variable names assigned to values rather than the values themselves.


In the following example, the math.min() method is called twice. The first call gives the numbers directly to the function. The second call uses the variable names assigned to the values instead of the values themselves.

v = 1
a = 4
l = 7
print(math.min(2, 6, 10))
print(math.min(v, a, l))

This will result in the following output:


All contributors

Looking to contribute?

Learn Lua on Codecademy