This example:
out['signal-C'] = 0
delay = 120
out['signal-C'] = 1
Is not how Lua code on combinators work.
I.e. if you expect signal-C to be unset for 120 ticks and set afterwards there, it won't work like that - only "out" values after code exits matter.
In this case, combinator will run the code, and end up with delay=120 and out['signal-C']=1.
Based on that, it will delay next run by 120 ticks, and set signal-C = 1 on the circuit network.
It can be simplified to out['signal-C'], delay = 1, 120
- this will do exactly same thing.
So don't think you get anything useful from printing values you set before code exits, and to debug what such snippet does, you can just do this:
out['signal-C'] = 0
delay = 120
out['signal-C'] = 1
print('delay='..delay)
for k,v in pairs(out) do print(('out[%s] = %s'):format(k,v)) end
And that's it, no need to define anything special, just print inputs/env before code runs and outputs/env after.
(that's also what setting debug=true on the combinator does btw, printing this kind of before/after dump to factorio log)