Changes

no edit summary
Line 24: Line 24:  
local sorted = false
 
local sorted = false
 
local sequence = nil
 
local sequence = nil
 +
local sequence_length = nil
 
local sequence_position = nil
 
local sequence_position = nil
 
local env = {}
 
local env = {}
Line 297: Line 298:  
             sequence = enumerating_function()
 
             sequence = enumerating_function()
 
             sequence_position = 1
 
             sequence_position = 1
 +
            sequence_length = #sequence
 
         elseif not sequence then
 
         elseif not sequence then
 
             local buildIterator = Iterator[enumerator]
 
             local buildIterator = Iterator[enumerator]
Line 306: Line 308:  
                     table.insert(sequence, iterator.current())
 
                     table.insert(sequence, iterator.current())
 
                 end
 
                 end
             end  
+
                sequence_length = #sequence
 +
             end
 
         end
 
         end
 
         if args.sort and sequence and not sorted then
 
         if args.sort and sequence and not sorted then
Line 413: Line 416:  
             i = i + 1
 
             i = i + 1
 
         end
 
         end
     until not sequence or sequence_position > #sequence
+
     until not sequence_length or sequence_position > sequence_length
 
     return table.concat(values, args.concat or (args.format == "table" and "" or ", "))
 
     return table.concat(values, args.concat or (args.format == "table" and "" or ", "))
 
end
 
end
    
return { format = function(frame) return interpret_args(U.getTemplateArgs(frame).explicit) end }
 
return { format = function(frame) return interpret_args(U.getTemplateArgs(frame).explicit) end }
cssedit, gkautomate
7,064

edits