Simple,
Import brl.reflection Import sidesign.minib3d Local obj:Object Local typ:String = "TEntity" obj = CreateNew(typ) If TEntity(obj) Local ent:TEntity = TEntity(obj) ent.name = "An Entity" Print ent.name EndIf Function CreateNew:Object(ObjType:String) 'Creates a new object based on a string containing the desired Type Local id:TTypeId = TTypeId.ForName(ObjType) If id Return id.NewObject() Else Return Null 'P.S. This line will never get printed, because you have it after return :P Print ("Object type " + ObjType + " is not recognized") EndIf End Function