How do I use function pointers?
I want to make a scripting engine, with a function that associates a string with a function, so when the parser comes accross that string, it executes the function that is associated with it in a table. I know this can be done with function pointers, but... what are function pointers? It would be a great help if someone would give me some code or a link.
Thanks.
|
"Finger to spiritual emptiness underlying everything." -- How a C manual referred to a "pointer to void." --Things People Said
![Resist Windows XP''s Invasive Production Activation Technology!](http://druidgames.warfactory.com/Out_Source/resist.jpg)
http://druidgames.cjb.net/
Just as an added thought ... you may want to typedef your function pointer. It will make your life a little easier, especially if you ever have the requirement to typecast.
--
--
You might want to use a std::map<> structure to map out your functions for your scripting thing...
ie
Just a hint
regards,
ecko_53
-----------------------------------------------------------
"If I wanted to hear the pitter patter of little feet I would put shoes on my cat"
ie
|
Just a hint
regards,
ecko_53
-----------------------------------------------------------
"If I wanted to hear the pitter patter of little feet I would put shoes on my cat"
-----------------------------------------------------------"People who usualy use the word pedantic usualy are pedantic!"-me
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement