lslint

lslint is a tool to check the syntactic and semantic validity of Second Life LSL scripts. It is basically a compiler that produces no output, but has helpful error messages, warnings, and checks for some common problems in LSL. It is mainly for use with an external editor. You can use it online or download it and run it on your own computer.

Builtin Functions

Starting with version 0.3.0, lslint can load the list of builtin functions from an external file. This way, when new functions are added to LSL, you do not have to wait for a new version of lslint. You can either add new functions manually, or use the perl script below to automatically extract them from the Second Life source.

To use the conversion script, download the lscript_library.cpp file from the release you want to use. Then run:

 perl builtins.pl < lscript_library.cpp > builtins.txt

To use your own builtins.txt with lslint, specify -b on the command line, ex:

 lslint -b C:\lslint\builtins.txt myfile.lsl

Download

Before you download, I strongly advise you to install a virus scanner and make sure it is updated. AVG Free Edition (Windows and Linux) and AntiVir Personal (Windows, Linux, FreeBSD, and Solaris) are free for non-commercial use. Trend Micro's Housecall (Windows) runs in your browser, for free, and NOD32 (Windows) has a free 30-day trial.

Latest version: v0.3.0 2007-11-23 ChangeLog

VersionWindowsMacLinux
0.3.090.5 KB156.7 KB340.6 KB
0.2.990.5 KB156.5 KB338.5 KB
0.2.890.5 KB156.3 KB338.3 KB
0.2.790 KB170.2 KB348.5 KB
0.2.689.5 KB-300.9 KB
0.2.588.5 KB-89.1 KB
0.2.486 KB98.3 KB86.6 KB
0.2.387 KB98.2 KB86.5 KB
0.2.285.5 KB432.8 KB86.7 KB
0.2.180.5 KB--
0.2.0252 KB--
0.1.2244 KB--
0.1.1244 KB--

Similar Tools

Alphons van der Heijden (Alphons Jano in Second Life) has put together an editor for Windows called LSL-Editor. Not only does it do everything you'd expect from an editor, but it can check, compile, and test(!) your code offline, without touching Second Life.

Try Online

Paste your script into the box below to try lslint online.



show locations as ranges (-l)
be verbose (-v)
don't sort messages (-S)
show error codes (-#)
check assertions (-A)
show version (-V)


Example Script

Paste this script into the box above for a good example of what lslint does.

integer number = 2+2;               // non constant
integer number = 3;                 // will only pass because above fails
integer number = 4;                 // already declared

string unused()  {                  // warning: declared but never used
    state default;                  // error: can't change state in function
    if (TRUE) {
        state default;              // warning: hack that corrupts stack
        return;                     // error: returning nothing in int function
    }
}

string test(integer a, vector v) {
    string q;                       // warning: declared but never used
    return v;                       // error: returning vector in string function
}

default {

    state_entry(integer param) {    // state_entry does not take params
        integer number = "hello";   // type mismatch, warning: shadow decl
        int q;                      // should point out int->integer typo maybe
        number = number-2;          // warning: parsed as IDENTIFER INTEGER
        number = 2-2;               // warning: 2-2 = 2
        [1] == [2];                 // warning: list == list only compares length
        number = number;            // warning: (above too) statement with no effect
        str = "hi!";                // undeclared
        llSay(0, number.x);         // number is not a vector
        LLsay(0, llListToString([])); // typos; suggest llSay, llList2String
        test(1, "hi");              // arg 2 of test should be vector but got string
        jump number;                // number is not a label
        jump label;                 // warning: when using multiple jumps to the
        jump label;                 //     same label, all but the last is ignored
        @label;
        return number;              // returning a value in an event
        state default;              // warning: switch to current state acts like return
                                    // warning: code is never reached
    }

    touch_start() {                 // requires parameters
    }

    at_target(integer i, vector v, string s) { // third parameter should be vector
    }

}