Accumulate a selected number of values as a small rolling-window model.

Window Total

window_total.lua
local window = 
local total = 0
local seen = 0

for _, value in ipairs({4, 6, 8, 10}) do
  if seen < window then
    total = total + value
    seen = seen + 1
  end
end

print("window=" .. window)
print("seen=" .. seen)
print("total=" .. total)
local window = 
local total = 0
local seen = 0

for _, value in ipairs({4, 6, 8, 10}) do
  if seen < window then
    total = total + value
    seen = seen + 1
  end
end

print("window=" .. window)
print("seen=" .. seen)
print("total=" .. total)
local window = 
local total = 0
local seen = 0

for _, value in ipairs({4, 6, 8, 10}) do
  if seen < window then
    total = total + value
    seen = seen + 1
  end
end

print("window=" .. window)
print("seen=" .. seen)
print("total=" .. total)
window Windowed pipelines use a bounded prefix or range of records.
total The total is a scalar checkpoint that replay can inspect at every step.