Oh, with Lua you can work with numbers that high, that you aren't able to imagine how much the number actually is. The Problem is, that after some time you'll loose precision. So eventhough Lua is able to store the value 10^300 (at least on the standard Lua interpreter for the Windows command line) precision is to low to differenciate between 10^300 and (10^300)-9, which causes the for loop
|
Source code
|
1
|
for i = (10^300)-9, 10^300 do print(i) end
|
to result in an infinite loop instead of printing only 10 numbers. No you can't go much higher, at some Point Lua will handle your value as intinity, which fyi is also stored in math.huge.
So the technical limit for you lies in the borders of the integer range of a specific Lua compiler as in RoM. But this is configurable by Runewaker and I don't know from ingame tests if they have changed something about that. But even without such information, the limit is damn high, higher than you would ever want to use.
More Information:
http://stackoverflow.com/questions/94573…a-number-in-lua
|
Source code
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
-- get the maximum integer precision value
function mathFormat(n)
local left,digits,decimals,right = string.match(tostring(n),"^([^%d]*%d)(%d*)%.?(%d*)(.-)$")
digits = digits and digits:reverse():gsub("(%d%d%d)","%1."):reverse() or ""
decimals = (decimals or "") ~= "" and ","..(decimals:gsub("(%d%d%d)", "%1."):gsub("(.*)%.$", "%1")) or ""
return (left or "")..digits..decimals..(right or "")
end
local val = 0
for stepExp = 25, 0, -1 do
for i = val, math.huge, 10^stepExp do
if i == (i+1) then
val = i - (10^stepExp)
break
end
end
end
print(string.format("the maximum integer precision value is: %s", mathFormat(string.format("%.0f",val+1))))
|