MoonJuice
Library for TASBox's custom scripting language that transpiles to Lua.
In most cases you won't need to use this, as the Luau library automatically transpiles MoonJuice scripts ending in .mj.
Functions
MoonJuice.toLuau
Transpiles the provided MoonJuice source code to Luau, returning any syntax errors.
MoonJuice.toLuau(source: string): string, MoonJuiceError[]
Parameters
| Name | Type | Default Value | Description |
|---|---|---|---|
| source | string | Required | MoonJuice source code. |
Returns
| Name | Type | Description |
|---|---|---|
| transpiledSource | string | Transpiled Luau source code. Only valid if there are no errors. |
| syntaxErrors | MoonJuiceError[] | List of syntax errors in the provided source. |
Types
MoonJuiceError
Syntax error in MoonJuice source code.
type MoonJuiceError = { message: string, start: MoonJuicePosition, end: MoonJuicePosition }
Properties
| Field | Type | Description |
|---|---|---|
| message | string | Error message. |
| start | MoonJuicePosition | Start of the error in the source code. |
| end | MoonJuicePosition | End of the error in the source code. |
MoonJuicePosition
Describes a location in MoonJuice source code by its line and column numbers.
type MoonJuicePosition = { line: number, column: number }
Properties
| Field | Type | Description |
|---|---|---|
| line | number | Line in the source code. |
| column | number | Column in the source code. |