Modify

Opened 2 years ago

Closed 2 years ago

#3593 closed Feature Request (Rejected)

IsFunc() - check if function exist by string

Reported by: mLipok Owned by:
Milestone: Component: AutoIt
Version: Severity: None
Keywords: Cc:

Description (last modified by mLipok)

IsFunc() should have feautre to check if string is reperesenting FunctionName in function list.

This feature is very much needed to validate user function parameters.

In this following example only third test should fail but second should display message.

_Test(_msg, 1)
_Test("_msg", 2)
_Test("Fake_msg", 3)

Func _Test($sFunction, $iTest)
	If IsFunc($sFunction) Then $sFunction($iTest)
EndFunc   ;==>_Test1

Func _Msg($iTest)
	MsgBox(0, "Test", $iTest)
EndFunc   ;==>_Msg

Remarks:
I think that, "Return values" should not need to be changed.

This is even more necessary if user want to use external tools to obfuscate code like Au3Stripper.

Attachments (0)

Change History (6)

comment:1 Changed 2 years ago by mLipok

  • Description modified (diff)

comment:2 Changed 2 years ago by mLipok

  • Description modified (diff)

comment:3 Changed 2 years ago by mLipok

  • Description modified (diff)

comment:4 Changed 2 years ago by TicketCleanup

  • Version Other deleted

Automatic ticket cleanup.

comment:5 Changed 2 years ago by Imp

Problem may be solved by one additional string:

Func _Test($sFunction, $iTest)
	IF IsString( $sFunction ) Then $sFunction = Execute( $sFunction )
	If IsFunc($sFunction) Then $sFunction($iTest)
EndFunc   ;==>_Test1

comment:6 Changed 2 years ago by mLipok

  • Resolution set to Rejected
  • Status changed from new to closed

hmm...
I never would have thought that the Execute() function works in this way too.
This is a good work around Thanks.

In this case IsFunc() should be treated as a separate function to check as it is (checking on if given parameter is already function)

btw.
This will be a little funny as I reject my own ticket.

Guidelines for posting comments:

  • You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
  • In-depth discussions should take place on the forum.

For more information see the full version of the ticket guidelines here.

Add Comment

Modify Ticket

Action
as closed The ticket will remain with no owner.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.