Module:IP: Difference between revisions

From the Croc Wiki, the Croc encyclopedia
Jump to navigationJump to search
restore MAX_ITERATIONS that I missed
(implement subnet walk (I have to do something!))
(restore MAX_ITERATIONS that I missed)
Line 11:
local V4 = 'IPv4'
local V6 = 'IPv6'
-- The maximum number of iterations allowed by Subnet:walk. The time limit for
-- running scripts will very likely be exceeded before this number is reached,
-- but having a maximum ensures that the number of iterations is precise for
-- Scribunto installations with a very large or disabled execution time limit.
local MAX_ITERATIONS = 2^32
 
--------------------------------------------------------------------------------
Line 496 ⟶ 501:
 
function obj:walk()
local startedcount = 0
local current = self:getPrefix()
local highest = self:getHighestIP()
return function ()
ifcount not= startedcount then+ 1
startedif count == 1 truethen
return current
end
if count <= MAX_ITERATIONS and current < highest then
current = current:getNextIP()
return current
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.

Navigation menu