I have a function name in a variable as a string
I dont know how to call that function using that variable
Can some one help
thanks in advance
I dont know how to call that function using that variable
Can some one help
thanks in advance
Type TFunction Field Func:Int( args:Object[]) EndType Global Functions:TMap = New TMap Function AddFunction( name:String, func:Int( args:Object[])) Local fn:TFunction = New TFunction fn.Func = func Functions.Insert( name, fn) EndFunction Function CallFunction:Int( name:String, args:Object[] = Null) Local fn:TFunction = TFunction( Functions.ValueForKey( name)) If fn Then Return fn.Func( args) Return False EndFunction ' ' TEST ' AddFunction( "test", TestFunction) CallFunction( "test") CallFunction( "test", ["testing, testing"]) Function TestFunction:Int( args:Object[]) If args.Length = 1 Then Print "Hello from TestFunction( ~q" + args[0].ToString() + "~q)" Else Print "Hello from TestFunction()" EndIf EndFunction