Linden Scripting Language Syntax

By Xah Lee. Date: .
Get your Xah Particle Maker today!

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!