Im using TMap to store a string as a key, with a function pointer as the value. I have to force both as objects when inserting them into the map. How do I get the function pointer back and call it?!
Im a bit stumped here...
Theres some code for you.
What im tryign to exactly do is register a creation function with a classname for each entity. When you want to create that entity, you call CreateEntityByClassname with the class you want to create, it will then call that entities classnames creation function and return the entity created.
The creation function isn't in a type or a method.
Im a bit stumped here...
Function CreateEntityByClassname:TEntity(Class:String) If MapContains(TEntity.Classes,Class) Local c()=MapValueForKey(TEntity.Classes,Class) Return c() EndIf Return Null End Function Function RegisterClass(cr:TEntity(),name:String) MapInsert(TEntity.Classes,Object(name),Object(cr())) End Function
Theres some code for you.
What im tryign to exactly do is register a creation function with a classname for each entity. When you want to create that entity, you call CreateEntityByClassname with the class you want to create, it will then call that entities classnames creation function and return the entity created.
The creation function isn't in a type or a method.