Difference between revisions of "Talk:Return"

From Second Life Wiki
Jump to navigation Jump to search
(New page: Scenario: Function in 2 seperate branches of "IF" calls a function returning an integer. Execution of the script is NOT ALWAYS returned to the point calling for a return value. <pre> int...)
 
(Crash described on main page appears to be fixed.)
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
Scenario: Function in 2 seperate branches of "IF" calls a function returning an integer.
Curious to find out what a crashed script looks like as I'd never seen one before, I tried to use return with integers and strings in several events, including state_entry, listen, touch_start and changed and all resulted in compile errorsSeems this one's been fixed. -- Ree Indigo 2/25/09 --
Execution of the script is NOT ALWAYS returned to the point calling for a return value.
 
<pre>
 
integer IsTrue( string SomeValue )
{
  if( SomeValue == WhatImLookingFor )
  {
      return TRUE;
  }
  return FALSE;
}
</pre>
 
Simple enough ..
 
 
<pre>
SomeOtherFunction( string SomeParameter, integer ANumber )
{
  if( ANumber == 1 )
  {
    if( IsTrue( SomeParameter ) )
    {
        llSay( 0, "FOO" );
    }
  {
  if( ANumber == 2 )
  {
      if( IsTrue( SomeParameter ) )
      {
          llSay( 0, "FUBAR" );
      }
  }
}
 
</pre>
 
 
Also fairly clear what should happen... BUT . Suppose ANumber = 2 and IsTrue does indeed return TRUE!!  (OMG!)
 
The output of this set of functions seems to never **EVER** say "FUBAR".
 
Given that ANumber = 2 and IsTrue( SomeParameter ) returns TRUE -->>  This script will say "FOO" and should not.
 
Any Clues?

Latest revision as of 02:03, 25 February 2009

Curious to find out what a crashed script looks like as I'd never seen one before, I tried to use return with integers and strings in several events, including state_entry, listen, touch_start and changed and all resulted in compile errors. Seems this one's been fixed. -- Ree Indigo 2/25/09 --