W-Hat
postcardscontact
faq
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.
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
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
| Version | Windows | Mac | Linux |
|---|---|---|---|
| 0.3.0 | 90.5 KB | 156.7 KB | 340.6 KB |
| 0.2.9 | 90.5 KB | 156.5 KB | 338.5 KB |
| 0.2.8 | 90.5 KB | 156.3 KB | 338.3 KB |
| 0.2.7 | 90 KB | 170.2 KB | 348.5 KB |
| 0.2.6 | 89.5 KB | - | 300.9 KB |
| 0.2.5 | 88.5 KB | - | 89.1 KB |
| 0.2.4 | 86 KB | 98.3 KB | 86.6 KB |
| 0.2.3 | 87 KB | 98.2 KB | 86.5 KB |
| 0.2.2 | 85.5 KB | 432.8 KB | 86.7 KB |
| 0.2.1 | 80.5 KB | - | - |
| 0.2.0 | 252 KB | - | - |
| 0.1.2 | 244 KB | - | - |
| 0.1.1 | 244 KB | - | - |
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.
Paste your script into the box below to try lslint online.
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
}
}