Catspeak Reference


presets

🔬 This is an experimental feature. It may change at any moment.

Presets are built-in collections of GML functions and constants which can be shared between different instances of CatspeakEnvironment in bulk.

A limited set of safe, built-in GML standard library functions and constants are packaged with Catspeak by default. See Catspeak.interface if you need to expose individual functions instead of many.

§ catspeak_preset_add

function catspeak_preset_add(
  key : Any,
  callback : Function,
)
🔬 This is an experimental feature. It may change at any moment.

Adds a new global preset function which can be used to initialise any new catspeak environments.

Arguments

  • key

    The key to use for the preset. Preferably a string, but it can be any value type.

  • callback

    The function to call to initialise the environment.

Example

Adds a new preset called "my-custom" which, when applied, will add an rgb function to the given CatspeakEnvironment.

catspeak_preset_add("my-custom", function (interface, keywords) {
  interface.exposeFunction("rgb", make_colour_rgb);
});

This preset can then be applied using Catspeak.applyPreset:

Catspeak.applyPreset("my-custom");