Lua maxinteger

Anonymous contributor's avatar
Anonymous contributor
Published Oct 18, 2023
Contribute to Docs

In Lua, the math.maxinteger is a constant that is part of the Lua math library. The math.maxinteger constant is used to return the largest possible integer value.

Note: The math.maxinteger constant is only available in Lua 5.3 and above. For earlier versions of Lua, the math.huge constant is available instead.

  • Looking for an introduction to the theory behind programming? Master Python while learning data structures, algorithms, and more!
    • Includes 6 Courses
    • With Professional Certification
    • Beginner Friendly.
      75 hours
  • Learn the basics of Lua, a general-purpose programming language used for building games, web apps, and developer tools.
    • Beginner Friendly.
      4 hours

Syntax

As maxinteger is a part of the standard Lua math library, it must be called as math.maxinteger.

math.maxinteger

Example

To find the largest possible integer value in Lua:

print(math.maxinteger)

This results in something like the following output:

9007199254740991

All contributors

Contribute to Docs

Learn Lua on Codecademy

  • Looking for an introduction to the theory behind programming? Master Python while learning data structures, algorithms, and more!
    • Includes 6 Courses
    • With Professional Certification
    • Beginner Friendly.
      75 hours
  • Learn the basics of Lua, a general-purpose programming language used for building games, web apps, and developer tools.
    • Beginner Friendly.
      4 hours