@skyrim-platform/jcontainers
Version:
TypeScript library for the JContainers Skyrim modding utility
193 lines (188 loc) • 12.1 kB
JavaScript
/*
==============================================
Typescript definitions for v4.2.1
==============================================
This file was automatically generated by Papyrus-2-Typescript.exe
https://github.com/CarlosLeyvaAyala/Papyrus-2-Typescript
The program has no way to know the intention of the humans that made
the scripts, so it's always advisable to manually check all generated
files to make sure everything is declared as it should.
Take note the program assumes this script exists in some subfolder
to the folder where `skyrimPlatform.ts` is found, otherwise you'll get
"Cannot find module..." type of errors.
If you want to have this script in some other place, just change the
relative path of each `import`.
*/
import * as sp from "skyrimPlatform";
/** Ordered collection of values (value is float, integer, string, form or another container).
Inherits JValue functionality */
var sn = sp.JArray;
/** creates new container object. returns container's identifier (unique integer number). */
export var object = function () { return sn.object(); };
/** Creates a new array of given size, filled with empty (None) items */
export var objectWithSize = function (size) { return sn.objectWithSize(size); };
/** Creates a new array that contains given values
objectWithBooleans converts booleans into integers */
export var objectWithInts = function (values) { return sn.objectWithInts(values); };
export var objectWithStrings = function (values) { return sn.objectWithStrings(values); };
export var objectWithFloats = function (values) { return sn.objectWithFloats(values); };
export var objectWithBooleans = function (values) { return sn.objectWithBooleans(values); };
export var objectWithForms = function (values) { return sn.objectWithForms(values); };
/** Creates a new array containing all the values from the source array in range [startIndex, endIndex) */
export var subArray = function (object, startIndex, endIndex) { return sn.subArray(object, startIndex, endIndex); };
/** 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 var addFromArray = function (object, source, insertAtIndex) {
if (insertAtIndex === void 0) { insertAtIndex = -1; }
return sn.addFromArray(object, source, insertAtIndex);
};
export var addFromFormList = function (object, source, insertAtIndex) {
if (insertAtIndex === void 0) { insertAtIndex = -1; }
return sn.addFromFormList(object, source, insertAtIndex);
};
/** Returns the item at the index of the array.
negative index accesses items from the end of container counting backwards. */
export var getInt = function (object, index, defaultVal) {
if (defaultVal === void 0) { defaultVal = 0; }
return sn.getInt(object, index, defaultVal);
};
export var getFlt = function (object, index, defaultVal) {
if (defaultVal === void 0) { defaultVal = 0.0; }
return sn.getFlt(object, index, defaultVal);
};
export var getStr = function (object, index, defaultVal) {
if (defaultVal === void 0) { defaultVal = ""; }
return sn.getStr(object, index, defaultVal);
};
export var getObj = function (object, index, defaultVal) {
if (defaultVal === void 0) { defaultVal = 0; }
return sn.getObj(object, index, defaultVal);
};
export var getForm = function (object, index, defaultVal) {
if (defaultVal === void 0) { defaultVal = null; }
return sn.getForm(object, index, defaultVal);
};
/** 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 var asIntArray = function (object) { return sn.asIntArray(object); };
export var asFloatArray = function (object) { return sn.asFloatArray(object); };
export var asStringArray = function (object) { return sn.asStringArray(object); };
export var asFormArray = function (object) { return sn.asFormArray(object); };
/** 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 var findInt = function (object, value, searchStartIndex) {
if (searchStartIndex === void 0) { searchStartIndex = 0; }
return sn.findInt(object, value, searchStartIndex);
};
export var findFlt = function (object, value, searchStartIndex) {
if (searchStartIndex === void 0) { searchStartIndex = 0; }
return sn.findFlt(object, value, searchStartIndex);
};
export var findStr = function (object, value, searchStartIndex) {
if (searchStartIndex === void 0) { searchStartIndex = 0; }
return sn.findStr(object, value, searchStartIndex);
};
export var findObj = function (object, container, searchStartIndex) {
if (searchStartIndex === void 0) { searchStartIndex = 0; }
return sn.findObj(object, container, searchStartIndex);
};
export var findForm = function (object, value, searchStartIndex) {
if (searchStartIndex === void 0) { searchStartIndex = 0; }
return sn.findForm(object, value, searchStartIndex);
};
/** Returns the number of times given value was found in a JArray. */
export var countInteger = function (object, value) { return sn.countInteger(object, value); };
export var countFloat = function (object, value) { return sn.countFloat(object, value); };
export var countString = function (object, value) { return sn.countString(object, value); };
export var countObject = function (object, container) { return sn.countObject(object, container); };
export var countForm = function (object, value) { return sn.countForm(object, value); };
/** 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 var setInt = function (object, index, value) { return sn.setInt(object, index, value); };
export var setFlt = function (object, index, value) { return sn.setFlt(object, index, value); };
export var setStr = function (object, index, value) { return sn.setStr(object, index, value); };
export var setObj = function (object, index, container) { return sn.setObj(object, index, container); };
export var setForm = function (object, index, value) { return sn.setForm(object, index, value); };
/** 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 var addInt = function (object, value, addToIndex) {
if (addToIndex === void 0) { addToIndex = -1; }
return sn.addInt(object, value, addToIndex);
};
export var addFlt = function (object, value, addToIndex) {
if (addToIndex === void 0) { addToIndex = -1; }
return sn.addFlt(object, value, addToIndex);
};
export var addStr = function (object, value, addToIndex) {
if (addToIndex === void 0) { addToIndex = -1; }
return sn.addStr(object, value, addToIndex);
};
export var addObj = function (object, container, addToIndex) {
if (addToIndex === void 0) { addToIndex = -1; }
return sn.addObj(object, container, addToIndex);
};
export var addForm = function (object, value, addToIndex) {
if (addToIndex === void 0) { addToIndex = -1; }
return sn.addForm(object, value, addToIndex);
};
/** Returns count of the items in the array */
export var count = function (object) { return sn.count(object); };
/** Removes all the items from the array */
export var clear = function (object) { return sn.clear(object); };
/** Erases the item at the index. negative index accesses items from the end of container counting backwards. */
export var eraseIndex = function (object, index) { return sn.eraseIndex(object, index); };
/** 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 var eraseRange = function (object, first, last) { return sn.eraseRange(object, first, last); };
/** Erase all elements of given value. Returns the number of erased elements. */
export var eraseInteger = function (object, value) { return sn.eraseInteger(object, value); };
export var eraseFloat = function (object, value) { return sn.eraseFloat(object, value); };
export var eraseString = function (object, value) { return sn.eraseString(object, value); };
export var eraseObject = function (object, container) { return sn.eraseObject(object, container); };
export var eraseForm = function (object, value) { return sn.eraseForm(object, value); };
/** 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 var valueType = function (object, index) { return sn.valueType(object, index); };
/** Exchanges the items at @index1 and @index2. negative index accesses items from the end of container counting backwards. */
export var swapItems = function (object, index1, index2) { return sn.swapItems(object, index1, index2); };
/** Sorts the items into ascending order (none < int < float < form < object < string). Returns the array itself */
export var sort = function (object) { return sn.sort(object); };
/** Sorts the items, removes duplicates. Returns array itself. You can treat it as JSet now */
export var unique = function (object) { return sn.unique(object); };
/** Reverse the order of elements. Returns the array itself. */
export var reverse = function (object) { return sn.reverse(object); };
/** 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 var writeToIntegerPArray = function (object, targetArray, writeAtIdx, stopWriteAtIdx, readIdx, defaultValRead) {
if (writeAtIdx === void 0) { writeAtIdx = 0; }
if (stopWriteAtIdx === void 0) { stopWriteAtIdx = -1; }
if (readIdx === void 0) { readIdx = 0; }
if (defaultValRead === void 0) { defaultValRead = 0; }
return sn.writeToIntegerPArray(object, targetArray, writeAtIdx, stopWriteAtIdx, readIdx, defaultValRead);
};
export var writeToFloatPArray = function (object, targetArray, writeAtIdx, stopWriteAtIdx, readIdx, defaultValRead) {
if (writeAtIdx === void 0) { writeAtIdx = 0; }
if (stopWriteAtIdx === void 0) { stopWriteAtIdx = -1; }
if (readIdx === void 0) { readIdx = 0; }
if (defaultValRead === void 0) { defaultValRead = 0.0; }
return sn.writeToFloatPArray(object, targetArray, writeAtIdx, stopWriteAtIdx, readIdx, defaultValRead);
};
export var writeToFormPArray = function (object, targetArray, writeAtIdx, stopWriteAtIdx, readIdx, defaultValRead) {
if (writeAtIdx === void 0) { writeAtIdx = 0; }
if (stopWriteAtIdx === void 0) { stopWriteAtIdx = -1; }
if (readIdx === void 0) { readIdx = 0; }
if (defaultValRead === void 0) { defaultValRead = null; }
return sn.writeToFormPArray(object, targetArray, writeAtIdx, stopWriteAtIdx, readIdx, defaultValRead);
};
export var writeToStringPArray = function (object, targetArray, writeAtIdx, stopWriteAtIdx, readIdx, defaultValRead) {
if (writeAtIdx === void 0) { writeAtIdx = 0; }
if (stopWriteAtIdx === void 0) { stopWriteAtIdx = -1; }
if (readIdx === void 0) { readIdx = 0; }
if (defaultValRead === void 0) { defaultValRead = ""; }
return sn.writeToStringPArray(object, targetArray, writeAtIdx, stopWriteAtIdx, readIdx, defaultValRead);
};