LSL Syntax

By Xah Lee. Date: .

LSL follows a syntax similar to the C language. Here's a sample code showing the syntax and basics of the language.

// comment starts with two slashes

// Examples of variable declaration and assignment:
integer score = 0;
string mySay = "i ♥ you";
vector v = <3,4,5>;
list myList= [3,4,v,mySay];

// Example of defining a function.
// most built-in function's names start with “ll” (Linden Library).
integer sum(integer a, integer b)
{
   integer result = a + b;
   return result; // Return statement is not required
}

default {
  state_entry() {
    llSay(0, mySay);
  }

  touch_start(integer total_number)
    {
      // examples of if.
      if (score == 1) { 
        llSay(0, mySay);
      } else {
        llWhisper(0, "Ouch!");
      }
    }
}

This paged gave you a overview of the syntax. Contiune to the lesson on Script Structure, or you can jump to collection of simple Script Examples.

Want to dash through walls?
Try Xah Tele-Dasher!

Linden Scripting Language

  1. LSL Tutorial
  2. Basic Concepts
  3. Syntax
  4. Code Structure
  5. Examples

advanced

  1. Prim Manipulation
  2. Particle System
  3. HUD

misc

  1. Emacs LSL Mode
  2. LSL References
  3. Misc Advanced LSL Tips
  4. LSL Unicode Support
  5. LSL Script Count
  6. Give Things Full Perm But No Script

LSL Problems

  1. LSL Problems
  2. llGetOwner()
  3. llEdgeOfWorld()
  4. llSitTarget as Teleporter