Call function using variable in function name?
Posted: Tue Sep 18, 2012 11:24 pm
I was wondering if there is a way to call a function using a variable? For example, suppose I have several functions created and they are named Func1, Func2, Func3 and Func4. And depending on what's going on, it will pull a value (1 thru 4) from a table... Is there a way to call the function named Func where i is the value I pulled from the table? Hope you understand what I'm looking for.
Also, suppose I have a table with multiple information in it for each record, how would I pull specific information for each record? for example, if I had:
(this is my first time working with tables. Does this look like it's formatted right?)
Suppose I target an NPC and it was "Mishlor." How would I match that to the specific record in the above table, and how would I then use the myindex, Npcx, or any of the other values associated with "Mishlor"?
Thanks.
Also, suppose I have a table with multiple information in it for each record, how would I pull specific information for each record? for example, if I had:
Code: Select all
table = {
{myindex="1", Npcname="Snoop the Stubborn", Npcx="123", Npcy="987", Npcz="456"}
{myindex="2", Npcname="Mishlor", Npcx="321", Npcy="789", Npcz="654"}
}Suppose I target an NPC and it was "Mishlor." How would I match that to the specific record in the above table, and how would I then use the myindex, Npcx, or any of the other values associated with "Mishlor"?
Thanks.