String and Functions

How can i call a function with a string.

Like this
Scriptname.string

ScriptName.FunctionName();
?

If i have stored the functionname inside a string

Assuming you have a method named MyMethod inside a class called MyClass:

typeof(MyClass).GetMethod("MyMethod").Invoke();

(This is in C# by the way, I’m not sure how to do it in Javascript)

I am using c# but i am getting a error

No overload for method Invoke' takes 0’ arguments

What should i put between the () after the Invoke

This is the Documentation for that Invoke function, place an instance of ScriptName or null if it’s static as the first parameter and null or the function parameters as the second parameter.

Thanks working now :slight_smile: