MCPcopy Create free account
hub / github.com/GarageGames/Torque3D / getObjectTokenField

Function getObjectTokenField

Engine/source/console/console.cpp:924–961  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

922
923//
924const char *getObjectTokenField(const char *name)
925{
926 const char *dot = dStrchr(name, '.');
927 if(name[0] != '$' && dot)
928 {
929 S32 len = dStrlen(name);
930 AssertFatal(len < sizeof(scratchBuffer)-1, "Sim::getVariable - object name too long");
931 dMemcpy(scratchBuffer, name, len+1);
932
933 char * token = dStrtok(scratchBuffer, ".");
934 SimObject * obj = Sim::findObject(token);
935 if(!obj)
936 return("");
937
938 token = dStrtok(0, ".\0");
939 if(!token)
940 return("");
941
942 while(token != NULL)
943 {
944 const char * val = obj->getDataField(StringTable->insert(token), 0);
945 if(!val)
946 return("");
947
948 token = dStrtok(0, ".\0");
949 if(token)
950 {
951 obj = Sim::findObject(token);
952 if(!obj)
953 return("");
954 }
955 else
956 return(val);
957 }
958 }
959
960 return NULL;
961}
962
963const char *getVariable(const char *name)
964{

Callers 4

getVariableFunction · 0.85
getBoolVariableFunction · 0.85
getIntVariableFunction · 0.85
getFloatVariableFunction · 0.85

Calls 7

dStrtokFunction · 0.85
getDataFieldMethod · 0.80
findObjectFunction · 0.70
dStrchrFunction · 0.50
dStrlenFunction · 0.50
dMemcpyFunction · 0.50
insertMethod · 0.45

Tested by

no test coverage detected