struct CatspeakForeignInterface
function CatspeakForeignInterface() constructor {
// 3 fields omitted
}Used by Catspeak code generators to expose foreign GML functions, constants, and properties to the generated Catspeak programs.
§ addBanList
static addBanList = function(
ban : String,
)Bans an array of symbols from being used by this interface. Any
symbols in this list will be treated as though they do not exist. To
unban a set of symbols, you should use the addPardonList method.
If a symbol was previously banned, this function will have no effect.
Arguments
banThe symbol to ban the usage of from within Catspeak.
§ addPardonList
static addPardonList = function(
pardon : String,
)Pardons an array of symbols within this interface.
If a symbol was not previously banned by addBanList, there will be
no effect.
Arguments
pardonThe symbol to pardon the usage of from within Catspeak.
§ exists
static exists = function(
name : String,
) -> BoolReturns whether a foreign symbol is exposed to this interface.
Arguments
nameThe name of the symbol as it appears in Catspeak.
Returns Bool
§ exposeAsset
static exposeAsset = function(
name : String,
)Exposes a GameMaker asset from the resource tree to this interface.
Arguments
nameThe name of the GM asset that you wish to expose to Catspeak.
§ exposeAssetByTag
static exposeAssetByTag = function(
tag : Any,
)Exposes a set of tagged GameMaker assets to this interface.
Arguments
tagThe name of a tag, or array of tags, of assets to expose to Catspeak.
§ exposeConstant
static exposeConstant = function(
name : String,
value : Any,
)Exposes a constant value to this interface.
📝 NoteYou cannot expose GML functions using this method. Instead you should use one of
exposeDynamicConstant,exposeFunction, orexposeMethod.
Arguments
nameThe name of the constant as it will appear in Catspeak.
valueThe constant value to add.
§ exposeDynamicConstant
static exposeDynamicConstant = function(
name : String,
func : Function,
)🔬 This is an experimental feature. It may change at any moment.
Exposes a "dynamic constant" to this interface. The value provided for the constant should be a script or method. When the dynamic constant is evaluated at runtime, the method will be executed with zero arguments and the return value used as the value of the constant.
Arguments
nameThe name of the constant as it will appear in Catspeak.
funcThe script ID or function to add.
§ exposeFunction
static exposeFunction = function(
name : String,
func : Function,
)Exposes a new unbound function to this interface. When passed a bound method (i.e. a non-global function), it will be unbound before it is added to the interface.
📝 NoteIf you would prefer to keep the bound
selfof a method, you should use theexposeMethodmethod instead.
Arguments
nameThe name of the function as it will appear in Catspeak.
funcThe script ID or function to add.
§ exposeFunctionByName
static exposeFunctionByName = function(
func : Function,
)Behaves similarly to exposeFunction, except the name of definition
is inferred. There are three ways this name will be inferred:
If the value is a script resource,
script_get_nameis used.If the value is a method and a
namefield exists, then the value of thisnamefield will be used as the name.If the value is a method and a
namefield does not exist, thenscript_get_namewill be called on the underlying bound script resource.
📝 NoteIf you would prefer to keep the bound
selfof a method, you should use theexposeMethodByNamemethod instead.
Arguments
funcThe script ID or function to add.
§ exposeFunctionByPrefix
static exposeFunctionByPrefix = function(
namespace : String,
)Exposes many user-defined global GML functions to this interface which share a common prefix.
Arguments
namespaceThe common prefix for the set of functions you want to expose to Catspeak.
§ exposeMethod
static exposeMethod = function(
name : String,
func : Function,
)Exposes a new bound function to this interface.
📝 NoteIf you would prefer to ignore the bound
selfvalue of the function, and treat it as a global script, you should use theexposeFunctionmethod instead.
Arguments
nameThe name of the method as it will appear in Catspeak.
funcThe script ID or method to add.
§ exposeMethodByName
static exposeMethodByName = function(
func : Function,
)Behaves similarly to exposeMethod, except the name of definition
is inferred. There are three ways a name will be inferred:
If the value is a script resource,
script_get_nameis used.If the value is a method and a
namefield exists, then the value of thisnamefield will be used as the name.If the value is a method and a
namefield does not exist, thenscript_get_namewill be called on the underlying bound script resource.
📝 NoteIf you would prefer to ignore the bound
selfvalue of the function, and treat it as a global script, you should use theexposeFunctionByNamemethod instead.
Arguments
funcThe script ID or method to add.
§ get
static get = function(
name : String,
) -> AnyReturns the value of a foreign symbol exposed to this interface.
Arguments
nameThe name of the symbol as it appears in Catspeak.
Returns Any
§ isDynamicConstant
static isDynamicConstant = function(
name : String,
) -> Bool🔬 This is an experimental feature. It may change at any moment.
Returns whether the foreign symbol is a "dynamic constant".
If the symbol hasn't been added then this function returns false.
Arguments
nameThe name of the symbol as it appears in Catspeak.
Returns Bool