Raised This Month: $ Target: $400
 0% 

Call public function by string


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Backstabnoob
BANNED
Join Date: Feb 2009
Location: Iwotadai Dorm
Old 12-29-2013 , 19:19   Call public function by string
Reply With Quote #1

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?

Last edited by Backstabnoob; 12-29-2013 at 19:22.
Backstabnoob is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 10:14.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode