# LSL language reference (HTML fragments)

Generated from the wiki snapshot in `lsl/wiki-2026-04-07/` by `tools/wiki/lsl_to_html.py`. Don't edit these pages by hand. Fix the converter and regenerate:

```bash
python3 tools/wiki/lsl_to_html.py            # writes lsl/html/*.html
python3 tools/validate_html.py lsl           # checks metadata and markup leaks
```

Every page follows `meta/html-conventions.md`. Each page starts with an `<!--sldocs {json} -->` comment, followed by a bare fragment that uses only the allowed elements. `--` inside JSON strings is written as `\u002d\u002d`.

## How it works

1. **Selection.** A Main-namespace page is selected when its top-level template is `{{LSL Function}}`, `{{LSL Function/Headless}}`, `{{LSL Event}}` or `{{LSL Constant}}`. The converter also takes a fixed list of type, keyword and operator pages. It skips function pages with `mode=user` or a name that doesn't start with `ll`, which are user library functions such as `Max` or `ListCast`. It also skips subpages, tutorials, library scripts, and User/Category/Talk pages. The snapshot already excludes redirects.
2. **Expansion.** A small MediaWiki preprocessor does brace matching, template arguments, `{{#if}}`/`#ifeq`/`#switch`/`#expr`/`#ifexpr`/`#pos`/`#sub`/…, and `#var`/`#vardefine` from the Variables extension. It expands each page using the wiki's own templates from `Template/`, including the `inject-N` helpers (`LSL Function/chat`, `/permission`, `/link-face`, …). Those helpers add parameter descriptions, caveats, constants tables and "see also" rows, so all of that appears here as it did on the wiki. Transcluded pages work too: `llSetPrimitiveParams` pulls in the `PRIM_*` pages.
3. **Page templates.** `LSL Function`, `LSL Function/Headless` + `/Head`, `LSL Event`, `LSL Constant` and `LSL Generic` are emulated in Python, so their sections come out as clean HTML. Presentational leaf templates are overridden: `LSLP` → `<var>`, `LSL DefineRow` → a table row (or a list item in *See also*), `HoverText`, `LSL Hex`, `Footnote`, `Issues/*`, and so on.
4. **Rendering.** The expanded wikitext of each section is converted to HTML: tables, headings, links, bold and italic, lists, paragraphs, leading-space `pre`, and `<syntaxhighlight>`/`<source>` → `<pre><code class="language-lsl">`. BeautifulSoup then sanitizes the result to the allowed elements.

Links to converted pages are relative (`llSay.html`). All other links go to `https://wiki.secondlife.com/wiki/…`. `[[integer]]`, `[[Default]]`, `[[Else]]` and similar resolve to the local type and keyword pages.

## Counts (1351 pages)

| kind | pages | notes |
|---|---|---|
| function | 595 | includes extra pages for secondary heads of multi-function pages (see below). 74 are `mode=request` feature requests that don't exist in LSL; they're marked `"status": ["unimplemented"]`. Where the wiki has two pages for one function (the 2026 snapshot added copies such as *LSL llEmail* beside *LlEmail*), the page with the canonical title wins and the copy is dropped. |
| constant | 688 | every `{{LSL Constant}}` page, plus `PRIM_CAST_SHADOWS` (a free-form page) |
| event | 51 | |
| type | 8 | `integer`, `float`, `string`, `key`, `list`, `vector` (from the `Category:LSL <Type>` pages, which is where `[[integer]]` etc. redirect), `rotation` (from the article *Rotation*), `quaternion` |
| flow-control | 7 | `state` (aliases `default`), `jump`, `return`, `if` (aliases `else`), `for`, `while`, `do` (title *do-while*) |
| keyword | 1 | `print` |
| operator | 1 | `operators` (from *LSL Operators*) |

Status flags come from the templates: 25 `deprecated`, 3 `god-mode` and 71 `unimplemented` (feature requests). The three `TOUCH_INVALID_*` pages say `mode=pre-release`, but `{{LSL Constant}}` ignores `mode`, so they carry no flag here either.

## Section layout

- **Functions and events:** description, Syntax (signature, forced delay and energy, or event ID and delay), Parameters (`<dl>`), Return value, Specification, Constants, Caveats (including "Important issues"), Examples (plus "Useful snippets"), Notes, See also (Constants / Events / Functions / Articles / Libraries), Deep notes (deep notes, Issues, Mono/LSO VM notes, History, Tests, Source, Messaging), Footnotes.
- **Constants:** the template's "The *type* constant X has the value V" sentence, the description, Syntax (`integer X = V;//comment`), Usage (the `pa`…`pd` blocks, e.g. the `llSetPrimitiveParams` rule boxes), Caveats, Examples, Notes, See also, Deep notes.

## Name collisions

Case-insensitive filename collisions are handled per the conventions: the first page by kind priority (type, keyword, function, event, constant) keeps the plain name, and the others get a `~kind` suffix. The final run had **no collisions**. The only one seen came from a source error: the wiki page *CLICK_ACTION_DISABLED* declares `name=CLICK_ACTION_TOUCH`. For constants whose `name=` disagrees with the page title, the title wins and the original value is kept in metadata as `source_name_param`.

## Multi-function pages

Some wiki pages document several functions through `{{LSL Function/Headless}}` with one `{{LSL Function/Head}}` per function. Each function gets its own file with the full shared body. The secondary files carry `"shares_page_with"`, and every file lists the group in `shared_page`. The secondary pages are: llSetLinkPrimitiveParams, llSetLinkPrimitiveParamsFast, llGetLinkPrimitiveParams, llGetObjectLinkKey, llLinkStopSound, llLinkAdjustSoundVolume, llLinkParticleSystem, llLinkSetSoundQueueing, llLinkSetSoundRadius, llLinksetDataReadProtected, llLinksetDataWriteProtected, llLinksetDataDeleteProtected.

## Known gaps and lossy conversions

- **Templates missing from the snapshot.** The templates below have no source in the snapshot, so their output is lost (only positional arguments survive). Counts are calls across all pages:
  - `LSL Constant/Pathfinding Character` (19; boilerplate on the `CHARACTER_*` constant pages)
  - `#ln` (9; an unknown parser function in the `llLog` table, rendered as `ln(N)` rather than a computed value)
  - `LSL Function/rotation` (2)
  - `LSL Constants/llSetEnvironment` (2)
  - `LSL Constants/llRezObjectWithParams` (1)
  - `LSL Function/velocity` (1)
  - `LlSitOnLinkConstants` (1)
  - `SLurl` (1)

  `{{Quaternion}}` (on the *Quaternion* page) is also missing. It is rendered as the bold word **quaternion**, because the surrounding sentence needs a subject.

  Other non-LSL templates (`Issues/*`, `Jira`, `HoverText`, `Wikipedia`, `KBcaution`, `SourceLink/github`, `Interval`, `CL`, `String`, `K`/`Keypress`, …) aren't in the snapshot either. They are emulated in the converter.
- **`Issues/<ID>` bug templates.** Their source isn't in the snapshot, so only the JIRA ID survives, listed under *Deep notes → Issues* with a link to jira.secondlife.com. The issue titles and bug/feature classification are lost, except when the `{{Issues|ID|text}}` form was used.
- **Dropped decoration.** Hover text (`title=` tooltips), colors, collapsible boxes and images are dropped. Text that existed only as a tooltip is lost: the `HoverText` second argument and the hover descriptions on parameters (`pN_hover`). The full descriptions (`pN_desc`) are kept.
- **Dropped chrome.** Navigation, language bars, haikus, edit links and the "needs example/FixMe" boxes are dropped.
- **Header boxes.** The wiki's yellow and red header boxes (deprecated, god mode, feature request, pre-release) are rewritten as a one-line `<p><strong>…</strong> …</p>` notice. The extra `text=` content is kept.
- **Table-heavy pages.** Pages such as `llSetPrimitiveParams`, `llGetObjectDetails` and the attachment and `OBJECT_*` constants keep their tables. Some of those tables were nested inside layout tables on the wiki, and that nesting is preserved, so a few pages have tables inside tables.
- **Category pages.** The *Category:LSL Rotation* page text isn't included; `rotation.html` uses the main *Rotation* article. Category pages' automatic member lists don't exist in wikitext, so they aren't reproduced.
- **Leading-space blocks.** These become `<pre><code class="language-text">`, as on the wiki. Plain `<pre>` blocks also become `language-text`, because the source doesn't say what language they are.
- **Literal markup in the source.** The source contains literal `[[:digit:]]`-style regex text (in `nowiki`) on four `llLinksetData*`/`llFindNotecardTextSync` pages. The converter writes the brackets as `&#91;` outside `<pre>` so they can't be mistaken for unconverted links.
- **`related`.** This field lists every converted page the body links to, so it includes parameter types such as `integer`.
- **Out of scope.** The snapshot is from April 2026 (see `CHANGES-2026-04-07.md` for what changed since the February 2025 snapshot), so newer LSL additions are missing. Constants that exist only as table rows, with no page of their own, have no file.

## Surprising things in the source

- The wiki page *CLICK_ACTION_DISABLED* says `name=CLICK_ACTION_TOUCH` (see above).
- 48 pages use `{{LSL Function}}` for user-written library functions whose names don't start with `ll`, e.g. `Max`, `ListCast` and the `Interpolation/*` pages. 32 of them are marked `mode=user`. All 48 are excluded.
- 71 function pages document LSL *feature requests* (`mode=request`): functions that don't exist, such as `llGetPizza`. They're kept and marked `unimplemented`.
- `Key`, `List`, `String` and `Vector` redirect to category pages. The real type documentation lives in `Category:LSL Key` and the other category pages.
