Graal Forums  

Go Back   Graal Forums > Development Forums > Tech Support
FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 06-22-2006, 12:13 PM
Skyld Skyld is offline
Script-fu
Skyld's Avatar
Join Date: Jan 2002
Location: United Kingdom
Posts: 3,914
Skyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud of
Send a message via AIM to Skyld
Quote:
Originally Posted by JustBreathe
It doesn't set anything at all. It totally ignores the assignment. I thought it was to prevent those who do if ( player.chat = "command" ) stuff;, but... Just because they have no notion of what an assignment operator does, doesn't mean that we should follow suit and make it into a comparison operator when those who do know have, now, no way of using the assignment operator.
What exactly are you expecting an assignment to return?
__________________
Skyld
Reply With Quote
  #2  
Old 06-22-2006, 12:18 PM
JustBreathe JustBreathe is offline
Registered User
Join Date: Jun 2006
Posts: 59
JustBreathe is on a distinguished road
Quote:
Originally Posted by Skyld
What exactly are you expecting an assignment to return?
temp.var = temp.var2 = temp.var3 = true;

is the same as

temp.var = ( temp.var2 = ( temp.var3 = true ) );
temp.var = ( temp.var2 = true );
temp.var = ( true );

if ( temp.var )... Temp.var would return true.
Reply With Quote
  #3  
Old 06-22-2006, 12:19 PM
Skyld Skyld is offline
Script-fu
Skyld's Avatar
Join Date: Jan 2002
Location: United Kingdom
Posts: 3,914
Skyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud of
Send a message via AIM to Skyld
Quote:
Originally Posted by JustBreathe
temp.var = temp.var2 = temp.var3 = true;

is the same as

temp.var = ( temp.var2 = ( temp.var3 = true ) );
temp.var = ( temp.var2 = true );
temp.var = ( true );

if ( temp.var )... Temp.var would return true.
So if you want it to return the value of the variable that you are assigning to, why did you not just say so?
__________________
Skyld
Reply With Quote
  #4  
Old 06-22-2006, 12:22 PM
JustBreathe JustBreathe is offline
Registered User
Join Date: Jun 2006
Posts: 59
JustBreathe is on a distinguished road
Quote:
Originally Posted by Skyld
So if you want it to return the value of the variable that you are assigning to, why did you not just say so?
If you used it in other languages, as does the person I was addressing the problem to has probably done, you would have understood.
Reply With Quote
  #5  
Old 06-22-2006, 07:34 PM
ApothiX ApothiX is offline
Okiesmokie
Join Date: May 2004
Posts: 1,447
ApothiX is on a distinguished road
Quote:
Originally Posted by Skyld
So if you want it to return the value of the variable that you are assigning to, why did you not just say so?
It has practical applications mainly with functions that return false on error. Instead of having to have two separate lines you can do it all in one.

ie:
PHP Code:
// ..
if(!(temp.blah Foo(this.bar))) {
  echo(
"ZOMG ERROR");
}
// ..
function Foo(bar) {
  if(
bar 10) return false;
  else return 
bar 10;

__________________


[06:24:19] * Parts: Skyld (i=silent@unaffiliated/skyld) ("Perhaps Okiesmokie did not realise that I like the boys. ")
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 10:16 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.