compatibility_v2
Contains a simple compatibility layer for help with converting projects from Catspeak 2 to Catspeak 3. There are many breaking changes between these versions, so sorry!
ยง catspeak_add_constant
function catspeak_add_constant(
name : String,
value : Any,
... : Any,
)
๐ Deprecated since 3.0.0Use
Catspeak.interface.exposeConstant
instead.
Permanently adds a new Catspeak constant to the default standard library.
If you want to add a function, use the catspeak_add_function
function
instead because it makes sure your value will be callable from within
Catspeak.
Arguments
name
The name of the constant to add.
value
The value to add.
...
The remaining key-value pairs to add, in the same pattern as the two previous arguments.
ยง catspeak_add_function
function catspeak_add_function(
name : String,
f : Function,
... : Any,
)
๐ Deprecated since 3.0.0Use
Catspeak.interface.exposeFunction
instead.
Permanently adds a new Catspeak function to the default standard library.
Arguments
name
The name of the function to add.
f
The function to add, will be converted into a method if a script ID is used.
...
The remaining key-value pairs to add, in the same pattern as the two previous arguments.
ยง catspeak_compile_buffer
function catspeak_compile_buffer(
buff : ID.Buffer,
consume? : Bool,
offset? : Real,
size? : Real,
) -> Struct.CatspeakProcess
๐ Deprecated since 3.0.0Use
Catspeak.parse
instead.
Creates a new Catspeak compiler process for a buffer containing Catspeak code.
Arguments
buff
A reference to the buffer containing the source code to compile.
consume
(optional)Whether the buffer should be deleted after the compiler process is complete. Defaults to
false
.offset
(optional)The offset in the buffer to start parsing from. Defaults to 0, the start of the buffer.
size
(optional)The length of the buffer input. Any characters beyond this limit will be treated as the end of the file. Defaults to
infinity
.
Returns Struct.CatspeakProcess
ยง catspeak_compile_string
function catspeak_compile_string(
src : Any,
) -> Struct.CatspeakProcess
๐ Deprecated since 3.0.0Use
Catspeak.parseString
instead.
Creates a new Catspeak compiler process for a string containing Catspeak
code. This will allocate a new buffer to store the string, if that isn't
ideal then you will have to create and write to your own buffer, then
pass it into the catspeak_compile_buffer
function instead.
Arguments
src
The value containing the source code to compile.
Returns Struct.CatspeakProcess
ยง catspeak_config
function catspeak_config()
-> Struct
๐ Deprecated since 3.0.0
Configures various global settings of the Catspeak compiler and runtime.
See the list in scr_catspeak_config
for configuration values and their
usages.
Returns Struct
ยง catspeak_create_buffer_from_string
function catspeak_create_buffer_from_string(
src : String,
) -> Id.Buffer
๐ Deprecated since 3.0.0
A helper function for creating a buffer from a string.
Arguments
src
The source code to convert into a buffer.
Returns Id.Buffer
ยง catspeak_execute
function catspeak_execute(
scr : Function,
args? : Array<Any>,
) -> Struct.Future
๐ Deprecated since 3.0.0Just invoke your script directly instead:
scr(args)
Creates a new Catspeak runtime process for this Catspeak function. This function is also compatible with GML functions.
Arguments
scr
The GML or Catspeak function to execute.
args
(optional)The array of arguments to pass to the function call. Defaults to the empty array.
Returns Struct.Future
ยง catspeak_into_gml_function
function catspeak_into_gml_function(
scr : Function,
) -> Function
๐ Deprecated since 3.0.0Use
Catspeak.compileGML
instead.
Converts a Catspeak function into a GML function which is executed immediately.
Arguments
scr
The Catspeak function to execute.
Returns Function
ยง catspeak_session_extern
function catspeak_session_extern(
scr : Struct.CatspeakFunction,
) -> Function
๐ Deprecated since 2.3.3Use
Catspeak.compileGML
instead.
The old name of catspeak_into_gml_function
from the compatibility
runtime for Catspeak.
Arguments
scr
The Catspeak function to execute.
Returns Function
ยง future_all
function future_all(
futures : Array<Struct.Future>,
) -> Struct.Future
๐ Deprecated since 3.0.0
Creates a new Future
which is accepted only when all other futures in an
array are accepted. If any future in the array is rejected, then the
resulting future is rejected with its value. If all futures are accepted,
then the resulting future is accepted with an array of their values.
Arguments
futures
The array of futures to await.
Returns Struct.Future
ยง future_any
function future_any(
futures : Array<Struct.Future>,
) -> Struct.Future
๐ Deprecated since 3.0.0
Creates a new Future
which is accepted if any of the futures in an
array are accepted. If all futures in the array are rejected, then the
resulting future is rejected with an array of their values.
Arguments
futures
The array of futures to await.
Returns Struct.Future
ยง future_error
function future_error(
value : Any,
) -> Struct.Future
๐ Deprecated since 3.0.0
Creates a new Future
which is immediately rejected with a value.
If the value itself it an instance of Future
, then it is returned
instead.
Arguments
value
The value to create a future from.
Returns Struct.Future
ยง future_ok
function future_ok(
value : Any,
) -> Struct.Future
๐ Deprecated since 3.0.0
Creates a new Future
which is immediately accepted with a value.
If the value itself it an instance of Future
, then it is returned
instead.
Arguments
value
The value to create a future from.
Returns Struct.Future
ยง future_settled
function future_settled(
futures : Array<Struct.Future>,
) -> Struct.Future
๐ Deprecated since 3.0.0
Creates a new Future
which is accepted when all of the futures in an
array are either accepted or rejected.
Arguments
futures
The array of futures to await.
Returns Struct.Future
ยง is_future
function is_future(
value : Any,
) -> Bool
๐ Deprecated since 3.0.0
Returns whether this value represents a future instance.
Arguments
value
The value to check.
Returns Bool