Store independent task results in scalar slots before summarizing them.

Task Result Slots

task_result_slots.lua
local function read_slot(value)
  return value + 10
end

local function write_slot(value)
  return value * 3
end

local seed = 
local read_value = 0
local write_value = 0

read_value = read_slot(seed)
write_value = write_slot(seed)
local total = read_value + write_value

print("read=" .. read_value)
print("write=" .. write_value)
print("total=" .. total)
local function read_slot(value)
  return value + 10
end

local function write_slot(value)
  return value * 3
end

local seed = 
local read_value = 0
local write_value = 0

read_value = read_slot(seed)
write_value = write_slot(seed)
local total = read_value + write_value

print("read=" .. read_value)
print("write=" .. write_value)
print("total=" .. total)
local function read_slot(value)
  return value + 10
end

local function write_slot(value)
  return value * 3
end

local seed = 
local read_value = 0
local write_value = 0

read_value = read_slot(seed)
write_value = write_slot(seed)
local total = read_value + write_value

print("read=" .. read_value)
print("write=" .. write_value)
print("total=" .. total)
task slots Separate result slots make replay easier to follow because each task updates its own scalar state.