mIRC Home    About    Download    Register    News    Help

Print Thread
#269601 14/11/21 03:32 PM
Joined: Jul 2006
Posts: 4,145
W
Wims Offline OP
Hoopy frood
OP Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,145
Code
alias testerror {
  var %testerror 1
  :label
  echo -sg testerror %testerror
  inc %testerror 
  if (%testerror == 2) goto label


  :error
  if ($error) { reseterror | echo -sg testerror: $v1 | return }
  if ( { noop }
}
/testerror

The first part shows that a regular label can be found above the current point in script (backward jump), because we get two echos
The second part shows that the :error goto label feature does not work the same as regular label because the error is not caught, this is unexpected to me, is it normal?


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Dec 2002
Posts: 5,411
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2002
Posts: 5,411
The goto and error label handling work in completely different ways.

The error handler is not jumping back in this case because the error label is before the command causing the error, so jumping back would likely result in an infinite loop.

That said, the error handler was implemented so long ago that the only way to be sure is to test it out. Either way, its behaviour will not be changed as this would cause backward compatibility issues.


Link Copied to Clipboard