Loader

loader #

Layer loader and (layer) dependency manager


methods #


M.define_layer #


function M.define_layer(layer) ->  nil

Registers a new layer in the current configuration @param layer string The layer to register

M.define_builtin #


function M.define_builtin(id: string) ->  nil

@param id - The layer identifier, by convention the same as the module name

Attempts to require the given layer within the default configuration. The procedure either throws an error or defines the layer.

M.is_builtin #


function M.is_builtin(id: string) -> Whether boolean

@param id - The layer identifier

@return Whether - the layer is builtin

Returns true if the requested layer is builtin (and can be loaded)

M.are_cyclic #


function M.are_cyclic(
  loading: table,
  list: (string[]|nil)
) -> return (string|nil)

@param loading - A table of already loading layers

@param list - The list of layer identifiers

@return return - The id of the layer being cyclically required, or nil if no loop was found.

Returns true if the list of layers have a cyclic relationship

M.packages #


function M.packages(id: string) ->  nil

@param id - The layer identifier

Calls the package function for the given layer and its dependencies

M.preload #


function M.preload(id: string) ->  nil

@param id - The layer identifier

Calls the preaload function for the given layer and its dependencies

M.load #


function M.load(id: string) ->  nil

@param id - The layer identifier

Loads a registered layer by its identifier with its dependencies. This function also takes care of calling all the needed functions on each layer to properly initialize your editor.

M.get #


function M.get(id: string) -> The any

@param id - The layer id

@return The - requested layer

Returns the requested layer by its id. This function adds all needed safety checks to the dangerous M.layers[id] access.

M.get_packages #


function M.get_packages() -> packages string[]

@return packages - The list of required packages

Returns the list of required packages

fields #


M.layers #


M.layers: table

M.packaged #


M.packaged: table

M.preloaded #


M.preloaded: table

M.loaded #


M.loaded: table

M._packages #


M._packages: table