Don't click here unless you want to be banned.

LSL Wiki : scope

HomePage :: PageIndex :: RecentChanges :: RecentlyCommented :: UserSettings :: You are crawl338.us.archive.org

scope

The scope of an identifier is the region of a script's source code where the identifier may be accessed. If the identifier is defined outside of a state or user-defined function it has a global scope, and it may be accessed anywhere within any of the script (after the definition). If the identifier is defined inside a state, or a user-defined function, or an event handler, then the scope is local to that containing context, and it may not be used outside of that context.


// local

default
{
  state_entry()
  {
    integer gNum = 6;
    // gNum == 6
  }

  touch_start(integer num_detected)
  {
    // gNum not defined
  }
}

// global
integer gNum = 6;

default
{
  state_entry()
  {
    // gNum == 6
  }

  touch_start(integer num_detected)
  {
    // gNum == 6
  }
}

Script | Code | Global | Local | Declare
There is one comment on this page. [Display comments/form]