# Function from a string?

**URL:** <https://forum.kirupa.com/t/function-from-a-string/227555>\
**Category:** Uncategorized\
**Created:** [May 31, 2007, 8:28am UTC](https://forum.kirupa.com/t/function-from-a-string/227555 "2007-05-31T08:28:21Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Macsy](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/macsy/32/3238_2.png) [@Macsy](https://forum.kirupa.com/u/Macsy)\
**Post date:** [May 31, 2007, 8:28am UTC](https://forum.kirupa.com/t/function-from-a-string/227555/1 "2007-05-31T08:28:21Z")

</div>

Hi.  
Im making a RPG game, like Final Fantasy / Zelda type.

A players attacktypes is in an array:  
like :

attacks = [melee,ice,fire]

Then when a for loop and some programming the player can choose witch skill to use.

Any good idea on how to tell what function to run?

Like:

1. attack[0] is choosen.
2. the attack function is called . How?
