getting the adress of a function by its name in string format

nikki via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Aug 30 09:58:24 PDT 2014


I would like to use json/or any other format for defining 
behavior trees.
in that file format I can only use strings

currently I just use the symbol directly but I was wondering how 
to 'find' them otherwise.


float EAT_FOOD_DECISION(Agent agent){
     return 1.0 - agent.hunger;
}
bool EAT_FOOD_BEHAVIOUR(Agent agent){
     agent.hunger -= 0.1;
}

auto eat_food = Behaviour(&EAT_FOOD_BEHAVIOUR);
auto eat_food_decider = 
Decider(DeciderType.Behaviour,&EAT_FOOD_DECISION[],eat_food);

instead I would like to use "EAT_FOOD_DECISION" and 
"EAT_FOOD_BEHAVIOUR" and get the functions?

Is that possible somehow?


More information about the Digitalmars-d-learn mailing list