Thread: Some questions
View Single Post
  #14  
Old 05-05-2011, 12:12 PM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Quote:
Originally Posted by papajchris View Post
Can strings like clientr. and client only be numbers? When I do scripts such as the following, they don't appear in attributes.

PHP Code:
function onPlayerTouchsme() {
 
client.high3=false;
} 
client and clientr variables can be anything but objects.

PHP Code:
player.clientr.foo = "bar"; // string
player.clientr.bar = 10 ^ 3; // number
player.clientr.baz = {"one", "two"}; // array
player.clientr.baa = true; // boolean 
Unlike languages like Java, Graal is a dynamically-typed language, which means you don't have to tell Graal what type of variable you want something to be. In Java, you would have to do

PHP Code:
String foo = "bar";
int bar = 10 ^ 3;
String[] baz = {"one", "two"};
boolean baa = true; 
Since you don't have to do that in Graal, the engine internally converts certain values to others. This doesn't affect behavior in this case.

Setting a value to true will show it equal to 1. Setting it to false will either show it equal to 0 or remove it from attributes altogether. Either works.

If a variable has never been set to false, it will by default be false.
__________________
Reply With Quote