View Single Post
  #5  
Old 03-16-2010, 03:25 PM
salesman salesman is offline
Finger lickin' good.
salesman's Avatar
Join Date: Nov 2008
Location: Colorado
Posts: 1,865
salesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud of
Quote:
Originally Posted by Cubical View Post
Is there an alternative to using temp.i = clientr.getdynamicvarnames(); because I can't seem to get it to work or even know if it does work.

I have a bunch of clientr vars like this
NPC Code:

clientr.blah.subvar = {array};
clientr.blah.subvar2 = {array};
clientr.blah.subvar3 = {array};



Any suggestions on what to do?
You want to get the variables of the clientr variable, "blah". Here's an example of what I mean:

PHP Code:
function test() {
  
this.blah.subvar = {1,2,3};
  
this.blah.subvar2 = {4,5,6};
  
this.blah.subvar3 = {7,8,9};

  
temp.blahVars this.blah.getDynamicVarNames();
  echo(
temp.blahVars); // echoes "subvar,subvar2,subvar3"
  
  // How this may be beneficial:
  
echo(this.hasVar("subvar2")); // echoes 1
  
echo(this.hasVar("subvar7")); // echoes 0

  // or
  
for (temp.foo temp.blahVars) {
    echo(
"Foo " temp.foo ": " this.blah.(@ temp.foo));
  }
  
/* 
     echoes:
     Foo subvar: 1,2,3
     Foo subvar2: 4,5,6
     Foo subvar3: 7,8,9
  */
}

function 
hasVar(foo) {
  
temp.blahVars this.blah.getDynamicVarNames();
  
  return (
temp.foo in temp.blahVars);

Let me know if this doesn't make sense
Reply With Quote