@skyrim-platform/jcontainers
Version:
TypeScript library for the JContainers Skyrim modding utility
97 lines (96 loc) • 8.34 kB
TypeScript
import { FormList } from "skyrimPlatform";
import { Form } from "skyrimPlatform";
/** creates new container object. returns container's identifier (unique integer number). */
export declare const object: () => number;
/** Creates a new array of given size, filled with empty (None) items */
export declare const objectWithSize: (size: number) => number;
/** Creates a new array that contains given values
objectWithBooleans converts booleans into integers */
export declare const objectWithInts: (values: number[]) => number;
export declare const objectWithStrings: (values: string[]) => number;
export declare const objectWithFloats: (values: number[]) => number;
export declare const objectWithBooleans: (values: boolean[]) => number;
export declare const objectWithForms: (values: Form[]) => number;
/** Creates a new array containing all the values from the source array in range [startIndex, endIndex) */
export declare const subArray: (object: number, startIndex: number, endIndex: number) => number;
/** Inserts the values from the source array into this array. If insertAtIndex is -1 (default behaviour) it appends to the end.
negative index accesses items from the end of container counting backwards. */
export declare const addFromArray: (object: number, source: number, insertAtIndex?: number) => void;
export declare const addFromFormList: (object: number, source: FormList | null | undefined, insertAtIndex?: number) => void;
/** Returns the item at the index of the array.
negative index accesses items from the end of container counting backwards. */
export declare const getInt: (object: number, index: number, defaultVal?: number) => number;
export declare const getFlt: (object: number, index: number, defaultVal?: number) => number;
export declare const getStr: (object: number, index: number, defaultVal?: string) => string;
export declare const getObj: (object: number, index: number, defaultVal?: number) => number;
export declare const getForm: (object: number, index: number, defaultVal?: Form | null | undefined) => Form | null | undefined;
/** Copy all items to new native Papyrus array of dynamic size.
Items not matching the requested type will have default
values as the ones from the getInt/Flt/Str/Form functions. */
export declare const asIntArray: (object: number) => number[];
export declare const asFloatArray: (object: number) => number[];
export declare const asStringArray: (object: number) => string[];
export declare const asFormArray: (object: number) => Form[];
/** Returns the index of the first found value/container that equals to given the value/container (default behaviour if searchStartIndex is 0).
If nothing was found it returns -1.
@searchStartIndex - index of the array where to start search
negative index accesses items from the end of container counting backwards. */
export declare const findInt: (object: number, value: number, searchStartIndex?: number) => number;
export declare const findFlt: (object: number, value: number, searchStartIndex?: number) => number;
export declare const findStr: (object: number, value: string, searchStartIndex?: number) => number;
export declare const findObj: (object: number, container: number, searchStartIndex?: number) => number;
export declare const findForm: (object: number, value: Form | null | undefined, searchStartIndex?: number) => number;
/** Returns the number of times given value was found in a JArray. */
export declare const countInteger: (object: number, value: number) => number;
export declare const countFloat: (object: number, value: number) => number;
export declare const countString: (object: number, value: string) => number;
export declare const countObject: (object: number, container: number) => number;
export declare const countForm: (object: number, value: Form | null | undefined) => number;
/** Replaces existing value at the @index of the array with the new @value.
negative index accesses items from the end of container counting backwards. */
export declare const setInt: (object: number, index: number, value: number) => void;
export declare const setFlt: (object: number, index: number, value: number) => void;
export declare const setStr: (object: number, index: number, value: string) => void;
export declare const setObj: (object: number, index: number, container: number) => void;
export declare const setForm: (object: number, index: number, value: Form | null | undefined) => void;
/** Appends the @value/@container to the end of the array.
If @addToIndex >= 0 it inserts value at given index. negative index accesses items from the end of container counting backwards. */
export declare const addInt: (object: number, value: number, addToIndex?: number) => void;
export declare const addFlt: (object: number, value: number, addToIndex?: number) => void;
export declare const addStr: (object: number, value: string, addToIndex?: number) => void;
export declare const addObj: (object: number, container: number, addToIndex?: number) => void;
export declare const addForm: (object: number, value: Form | null | undefined, addToIndex?: number) => void;
/** Returns count of the items in the array */
export declare const count: (object: number) => number;
/** Removes all the items from the array */
export declare const clear: (object: number) => void;
/** Erases the item at the index. negative index accesses items from the end of container counting backwards. */
export declare const eraseIndex: (object: number, index: number) => void;
/** Erases [first, last] index range of the items. negative index accesses items from the end of container counting backwards.
For ex. with [1,-1] range it will erase everything except the first item */
export declare const eraseRange: (object: number, first: number, last: number) => void;
/** Erase all elements of given value. Returns the number of erased elements. */
export declare const eraseInteger: (object: number, value: number) => number;
export declare const eraseFloat: (object: number, value: number) => number;
export declare const eraseString: (object: number, value: string) => number;
export declare const eraseObject: (object: number, container: number) => number;
export declare const eraseForm: (object: number, value: Form | null | undefined) => number;
/** Returns type of the value at the @index. negative index accesses items from the end of container counting backwards.
0 - no value, 1 - none, 2 - int, 3 - float, 4 - form, 5 - object, 6 - string */
export declare const valueType: (object: number, index: number) => number;
/** Exchanges the items at @index1 and @index2. negative index accesses items from the end of container counting backwards. */
export declare const swapItems: (object: number, index1: number, index2: number) => void;
/** Sorts the items into ascending order (none < int < float < form < object < string). Returns the array itself */
export declare const sort: (object: number) => number;
/** Sorts the items, removes duplicates. Returns array itself. You can treat it as JSet now */
export declare const unique: (object: number) => number;
/** Reverse the order of elements. Returns the array itself. */
export declare const reverse: (object: number) => number;
/** Writes the array's items into the @targetArray array starting at @destIndex
@writeAtIdx - [-1, 0] - writes all the items in reverse order
[0, -1] - writes all the items in straight order
[1, 3] - writes 3 items in straight order */
export declare const writeToIntegerPArray: (object: number, targetArray: number[], writeAtIdx?: number, stopWriteAtIdx?: number, readIdx?: number, defaultValRead?: number) => boolean;
export declare const writeToFloatPArray: (object: number, targetArray: number[], writeAtIdx?: number, stopWriteAtIdx?: number, readIdx?: number, defaultValRead?: number) => boolean;
export declare const writeToFormPArray: (object: number, targetArray: Form[], writeAtIdx?: number, stopWriteAtIdx?: number, readIdx?: number, defaultValRead?: Form | null | undefined) => boolean;
export declare const writeToStringPArray: (object: number, targetArray: string[], writeAtIdx?: number, stopWriteAtIdx?: number, readIdx?: number, defaultValRead?: string) => boolean;