Preprocessing
Jump to navigation
Jump to search
I suggest the ability to add preprocessing to LSL, as this has no effect on LSL itself but can provide scripts which can do many different things, depending on.
This would include.
- Basic Define keyword, can be used to define custom static variables. (these may need to be typed)
- IF, ELSE, ENDIF preprocessor branches
- IFDEF, IFNDEF preprocessors
As such a script such as this: <lsl>
- define DEBUG
- ifdef DEBUG
string mode = "DEBUG";
- else
string mode = "NORMAL";
- endif
default {
- ifdef DEBUG
on_rez(integer s) { llResetScript() }
- endif
state_entry() { llOwnerSay(mode);
- ifdef DEBUG
llOwnerSay(llGetDate(); }
- else
}
- endif
} </lsl>
Could produce two different scripts depending on the value of DEBUG, which would then get compiled/interpreted.
With DEBUG defined <lsl>
- define DEBUG
string mode = "DEBUG";
default {
on_rez(integer s) { llResetScript() }
state_entry() { llOwnerSay(mode); llOwnerSay(llGetDate(); }
} </lsl>
Without DEBUG defined <lsl> string mode = "NORMAL";
default {
state_entry() { llOwnerSay(mode); }
} </lsl>