C#C
C#4y ago
Pdawg

Calling a function from a string.

Hey, everyone! I have a timer that will run every 100ms, but I have a list of functions named "f1", all the way up to "f255". I know it sounds impractical to even have all of those functions, but I need them. Anyway, is it possible to have an int++ to call the next function on the list? I want it to do this every time the timer runs:

1: add 1 to the framei int.
2: add the 'f' at the start of the function name, then attach framei after it
3: call the function

Expected behavior:
100ms elapsed,
f1();
another 100ms elapsed
f2();
and so on.

Here is an example of the code that doesn't work:
unknown.png
Was this page helpful?