logo
pub fn resize_array<T: AsRef<str>>(name: T, size: i32) -> Result<(), SizeError>
Expand description

Resizes an array found by its name from the pd patch which is loaded.

Sizes <= 0 or > size limit are clipped to 1

Example

use libpd_rs::array::{array_size, resize_array};

resize_array("my_array", 1024).unwrap();
let size = array_size("my_array").unwrap();
assert_eq!(size, 1024);

resize_array("my_array", 0).unwrap();
let size = array_size("my_array").unwrap();
assert_eq!(size, 1);

Errors

A list of errors that can occur: