LavishScript:MetaScript

From Lavish Software Wiki
Revision as of 14:55, 28 October 2019 by Lax (talk | contribs) (→‎function definitions)
(diff) ←Older revision | view current revision (diff) | Newer revision→ (diff)
Jump to navigation Jump to search

A MetaScript is the combination of a Script and metadata. Scripts managed by a MetaScript are flagged with Retain and will not be ended by endscript * by default.

In the near future, MetaScripts will be expanded upon to provide LavishScript documentation from the given metadata.


Defining a MetaScript

MetaScripts can be defined by a JSON object. The JSON Schema for a MetaScript is provided at http://www.lavishsoft.com/schema/metascript.json

The MetaScript definition will be transformed into proper Script format for execution.

MetaScript properties
name (required) A name for the MetaScript. The name does not need to be unique against other MetaScripts (a single MetaScript can be loaded multiple times)
autoStart A boolean value specifying whether to automatically start the MetaScript when loaded
autoStartArgs An Array of parameters to pass to the main function (as if using RunScript)
includes An Array of strings to #include
optionalIncludes An array of strings to #includeoptional
variables An array of MetaScript variable definitions
objectdefs An array of MetaScript objectdef definitions
functions An array of MetaScript function definitions


variable definitions

MetaScript variable properties
name (required) A name for the variable
type (required) The type of variable (e.g. string, bool, uint)
value A value to initialize the variable with
scope A string specifying the variable scope, one of: local, script, global, globalkeep.

Note: Parameters do not specify scope, but are otherwise the same as a variable definition.


objectdef definitions

MetaScript properties
name (required) A name for the Script-defined Object Type
variables An array of MetaScript variable definitions
functions An array of MetaScript function definitions


function definitions

MetaScript function properties
name (required) A name for the function
type (required) The type of function, one of: atom, function, method, member
returnType A string specifying the return type of the function
code LavishScript code to place within the function
scope For atoms specifically, a string specifying the scope, one of: script, global, globalkeep.
parameters An array of variable definitions (each with no scope)

See Also