 
  Data Structure Data Structure
 Networking Networking
 RDBMS RDBMS
 Operating System Operating System
 Java Java
 MS Excel MS Excel
 iOS iOS
 HTML HTML
 CSS CSS
 Android Android
 Python Python
 C Programming C Programming
 C++ C++
 C# C#
 MongoDB MongoDB
 MySQL MySQL
 Javascript Javascript
 PHP PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
math.max() function in Lua programming
There are several occurrences when we want to get the max value from a given series of numbers and then use that value later on.
The Maximum value from the series of different numbers is the value that is the maximum of all the numbers that are present in that series.
Lua provides us with a math.max() function that we can use to find the max value out of different numbers that we pass to it as arguments.
Example
Let’s consider a simple example where we will make use of the math.max() function in Lua −
a = 10 b = 11 c = 12 print(math.max(a,b,c))
Output
12
It should be noted that if we try to pass the same numbers to the math.max() function then the output will be the same number itself.
Example
Consider the example shown below −
d = 11 e = 11 print(math.max(d,e))
Output
11
We can also pass negative numbers in the math.max() function as an argument.
Consider the example shown below −
Example
f = -10 g = -5 print(math.max(f,g))
Output
-5
