PHP Code:
//#CLIENTSIDE
public function getVarFromName(varname) {
if (varname.pos(".") == -1) return -1;
temp.tokens = varname.tokenize(".");
temp.objvar = new TStaticVar();
temp.objvar.copyfrom((@temp.tokens[0]));
return getSubObj(temp.objvar, temp.tokens.subarray(1, temp.tokens.size() - 2)).(@temp.tokens[temp.tokens.size() - 1]);
}
public function getSubObj(obj,subobjstrarray) {
if (subobjstrarray.size()) return getSubObj(obj.(@subobjstrarray[0]), subobjstrarray.subarray(1, subobjstrarray.size() - 1));
else return obj;
}
In 'getVarFromName', the function returns -1 if the input string does not have an object prefix. I would like to return a variable that does not have an object prefix but I am having trouble figuring out how to do so.
this.(@"name"), since there is an object prefix, gives me the correct result. (The name of the weapon)
(@"mousescreenx") gives me 'mousescreenx' as a string.
Is there a solution this problem?