Local declarations - Manhunter07/MFL GitHub Wiki

For the exclusive use within a file, an object can be marked as local. This applies to:

Members of values cannot be local. Neither can there be both a local and a non-local version of an object.

Declaration

To declare a local object, simply add the keyword ˋlocalˋ in front of the standard declaration:

local const Days = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"]
local function CurrentDay = Days.(System.DateTime.DateTimeRec(System.DateTime.Current).Weekday)
local type Day = enum(spread Days)

Remarks

When trying to access a local identifier from outside, a run-time error occurs. Declared returns true on local identifiers. To check if an identifier is local, use IsLocal.

Constructors and converters

A constructor inherits the both name and visibility from its referred type. If a type is declared as local, both its constructor and converter routines (if present) are local, too. You cannot therefore declare a local constructor or converter for a non-local type and vice versa.

⚠️ **GitHub.com Fallback** ⚠️