Modify

Opened 8 years ago

Closed 8 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 by mLipok, 8 years ago

Description: modified (diff)

comment:2 by mLipok, 8 years ago

Description: modified (diff)

comment:3 by mLipok, 8 years ago

Description: modified (diff)

comment:4 by TicketCleanup, 8 years ago

Version: Other

Automatic ticket cleanup.

comment:5 by Imp, 8 years ago

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 by mLipok, 8 years ago

Resolution: Rejected
Status: newclosed

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.

Modify Ticket

Action
as closed The ticket will remain with no owner.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.