lua-users home
lua-l archive

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


Thanks guys, all very useful responses! This is what I was trying to find. TY!

On Aug 31, 2017, at 12:57, Derek Bailey <dbaileychess@gmail.com> wrote:

In 5.3, there is math.maxinteger and math.huge (http://www.lua.org/manual/5.3/manual.html).
 


On Thu, Aug 31, 2017 at 12:39 PM, Matthias Dörfelt <lists@mokafolio.de> wrote:
Hi,

in C++ I often times use idioms like:

auto shortestDistance = std::numeric_limits<float>::max()
// …
for(auto item : list)
{
        float dist = determineDistance(item);
        if(dist < shortestDistance)
        {
                // ...
                shortestDistance = dist;
        }
}
// …

After browsing for a while I could not find any similar constant to std::numeric_limits<float>::max() to get the biggest available number in lua. Is there one? If not, is there a reliable way to build my own function/constant?

Thanks,
Matthias