Graal Forums  

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

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 06-22-2006, 10:43 AM
JustBreathe JustBreathe is offline
Registered User
Join Date: Jun 2006
Posts: 59
JustBreathe is on a distinguished road
Inconsistencies ( return values )

It is said that an 'if clause' should return true if the evaluation within isn't false.

PHP Code:
function onCreated()
  {
  
// eval function: return ( var ? true : false );
  // evalFIX function: return ( var != false );

  
eval( new TStaticVar() ); // returns false
  
evalFIX( new TStaticVar() ); // returns true

  
eval( false ); // returns false
  
evalFIXfalse ); // returns false

  
eval( "" ); // returns false
  
evalFIX"" ); // returns false

  
eval( null ); // returns false
  
evalFIXnull ); // returns false

  
eval( "false" ); // returns false
  
evalFIX"false" ); // returns false

  
eval( {"stuff""Things"} ); // returns false
  
evalFIX( {"stuff""Things"} ); // returns true

  
eval( "stuff,Things" ); // returns true
  
evalFIX"stuff,Things" ); // returns true

  
eval( true ); // returns true
  
evalFIXtrue ); // returns true

  
eval( "Stuff" ); // returns true
  
evalFIX"Stuff" ); // returns true

  
}

function eval( var )
  {
  return ( var ? 
true false );
  }

function 
evalFIX( var )
  {
  return (var != 
false);
  } 
As shown:

Objects return false in an if clause... obj != false, returns true.

"string,var" returns true, while {"string","var"} returns false. ( string representation of array, and array )...


I believe it would be better having the evalFix, rather than the eval as return... This would allow flexability as such:

PHP Code:
  if ( pl getPlayer("JustBreathe") )
    {
    
pl.stuff;
    } else {
    return 
false;
    } 
Reply With Quote
 

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 02:49 PM.


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