Implement TransferToWindow in DoubleValidator. Closes #1606.
Use lua_for_each more places