implementing worker index, and a way to access it from loop

with this patch it is possible to access the index of the worker using @worker.index, starting at 0