== Overview ==
The '''LiveGobe Module Language''' (LGML) is a scripting language used by LiveGobe Wiki System modules.
It is a modified subset of JavaScript designed for embedding logic within the LiveGobe Wiki environment — providing a sandboxed API surface and additional syntax for wiki-style interaction.
This guide will help you understand how to write, structure, and execute module code in LiveGobe Wiki System.
== Quick Start ==
Each module script runs in an isolated context and has access to special LiveGobe Wiki System-provided objects.
The entry point is the `module.exports`/`exports` object, where you define functions, constants, and handlers.
```javascript
exports = {
hello(frame) {
return "Hello " + frame[0] + "!";
}
};
```
You can then call this function in a page using:
```LGWL
{{{}}{{{}}#invoke:ExampleModule|hello|World}}
```
Output:
Hello World!
== Language Basics ==
The LG Module Language uses JavaScript syntax with small modifications.
=== Supported Features ===
* Variables (`let`, `const`, `var`)
* Functions and arrow functions
* Objects and arrays
* Control structures (`if`, `for`, `while`)
* String and number literals
* JSON-like syntax for data
=== Not Supported ===
* `eval`, `Function` constructor
* Direct DOM or file access
These restrictions ensure determinism and sandbox safety for wiki rendering.
== Template Interaction ==
You can also use module functions to generate wikitext that is then parsed as part of the page.
To do this, simply return a string containing LGWL markup.
```javascript
exports = {
makeTable() {
return `{{{}}|
! Name !! Value
|-
| Apple || 100
|-
| Banana || 200
|{{}}}`;
}
};
```
Output:
{|
! Name !! Value
|-
| Apple || 100
|-
| Banana || 200
|}
== See Also ==
* [[LiveGobe Module Language/Documentation]]
Viewing old revision of LiveGobe_Module_Language/Guide
You are viewing an old revision of this page from 11/7/2025, 8:23:55 PM.
View latest version