I'm creating a shopmenu and I want to make it as easy to configure as possible. As a result, I'm creating a global constant array, where you specify all the items as well as the function name which gets called once the item is selected, with passed data. What is the best method of calling this function?
Code:
enum _: itemData
{
_ItemName[ 32 ],
// ...
_ItemFuncToCall[ 32 ]
}
new const g_Items[ ][ itemData ] =
{
// ...
{ "Some Item", /* ... */ "func_name" }
}
// the best way to call this with passing data array?
public func_name( Data[ ] )
{
// some code
}
set_task is a possibility but I dislike the delay. There must be a better way.
Edit: Ability to stop execution of the function where this was called from would also be handful. It's possible with fakemeta forwards, but do I really need to use fakemeta forwards for one single plugin?