Jump to content

What?! No Functions without Parameters but Optional!


Recommended Posts

Func CLOSEClicked($msg="", $mopt=0)
  MsgBox($mopt, $LangAry[$langID][1], $msg)
  Exit
EndFunc

If I call the above function without passing any var, then autoit complains! It says $mopt is used without being declared. It seems functions in autoit cannot have all parameters as optional, right? :whistle:

Thank you

Link to comment
Share on other sites

  • Moderators

Worked fine for me beta .132

CLOSEClicked()
Func CLOSEClicked($msg = "", $mopt = 0)
  MsgBox($mopt, '', $msg)
  Exit
EndFunc
Of course I had to take out the $LangAry[$langID][1] :whistle:

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Worked fine for me beta .132

CLOSEClicked()
Func CLOSEClicked($msg = "", $mopt = 0)
  MsgBox($mopt, '', $msg)
  Exit
EndFunc
Of course I had to take out the $LangAry[$langID][1] :whistle:
$LangAry and $langID are globally defined.

I think this is a bug! I only get the error msg when the function is called by GUICtrlSetOnEvent. When I call the function directly, no error is given!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...