Skip to main content

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

NameTypeDefault ValueDescription
sourcestringRequiredMoonJuice source code.

Returns

NameTypeDescription
transpiledSourcestringTranspiled Luau source code. Only valid if there are no errors.
syntaxErrorsMoonJuiceError[]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

FieldTypeDescription
messagestringError message.
startMoonJuicePositionStart of the error in the source code.
endMoonJuicePositionEnd 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

FieldTypeDescription
linenumberLine in the source code.
columnnumberColumn in the source code.