Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
294 changes: 35 additions & 259 deletions _data/stdlib_index.json
Original file line number Diff line number Diff line change
Expand Up @@ -108723,263 +108723,6 @@
}
]
},
{
"package": "ArrayList",
"category": "data",
"categoryLabel": "Data Structures",
"sourcePath": "wurst/data/ArrayList.wurst",
"githubUrl": "https://github.com/wurstscript/WurstStdlib2/blob/master/wurst/data/ArrayList.wurst",
"summary": "High-performance array-based list using static shared storage per type.\nIn most cases, a LinkedList is a better choice due to its flexibility.\nThis data structure is only recommended for performance-critical code\nand requires careful use to avoid fragmentation.\n\nWHEN TO USE:\n===========\nArrayList is faster than LinkedList for:\n- Iterating large lists (1000+ elements) - no node indirection\n- Index based operations - O(1) vs O(n)\n- When only appending elements to the end\n\nLinkedList is better for:\n- Insertion anywhere except the end of the list\n- Deletions while retaining order\n- Unknown size requirements\n- No resize performance risk\n\nTYPE SYSTEM IMPLICATIONS:\n========================\nEach ArrayList<T> type gets its own static storage array.\n- ArrayList<int>, ArrayList<unit>, ArrayList<string> = 3 separate arrays\n- On the Jass target each type holds up to JASS_MAX_ARRAY_SIZE elements total across all\n instances (the Lua target grows dynamically and is not bounded by this)\n\nChoose wisely based on how many types you have.\n\nPERFORMANCE RULES:\n==================\n\n1. PRESIZE, DON'T RESIZE\n Bad: new ArrayList<int>() // Might resize multiple times\n Good: new ArrayList<int>(maxSize) // One allocation\n\n Why: Resize operations copy ALL elements to new memory. Expensive!\n\n2. REUSE, DON'T RECREATE\n Bad: In loop `let temp = new ArrayList<int>() ... destroy temp`\n Good: `let temp = new ArrayList<int>() ... temp.clear()` in loop\n\n Why: Allocation/Deallocation is moderately expensive and causes fragmentation\n\n3. ORDERED REMOVAL IS SLOW\n Bad: list.removeAt(i) // O(n) - shifts all elements\n Good: list.removeAtUnordered(i) // O(1) - swaps with last element\n\n Only use removeAtUnordered() if order doesn't matter\n\n4. ITERATE BY INDEX\n Good: for i = 0 to list.size()-1 // Zero allocation\n Good: list[i] // Indexing operator\n\n ArrayList has no iterator by design - index loops keep hot paths\n allocation-free.\n\n5. AVOID FREQUENT INSERTS AT START\n Bad: list.addtoStart(x) // O(n) every time\n Good: Use LinkedList or add in reverse order\n\nPERFORMANCE TABLE:\n==================\nOperation | ArrayList | LinkedList | Notes\n-------------------|-----------|------------|---------------------------\nadd(elem) | O(1)* | O(1) | *O(n) on resize!\naddtoStart(elem) | O(n) | O(1) | Shifts all elements\nget(index) | O(1) | O(n) | Major ArrayList advantage\nremoveAt(index) | O(n) | O(1) | Shifts remaining elements\nremoveAtUnordered | O(1) | N/A | Doesn't preserve order\nIterate all | Faster | Fast | LinkedList does double the work, but is still fast\nMemory per element | 1 slot | 3 slots | Element + 2 pointers\nCreate/destroy | Varies | High | AL might need memory management, LL needs to process Nodes\n\nMEMORY MANAGEMENT:\n==================\nArrayList uses section allocation in a shared static array per type.\nDestroyed lists return sections to a free pool for reuse.\nFree sections are compacted to reduce fragmentation.\n\nFragmentation occurs when lists grow - the old section becomes a gap.\nThis is why presizing matters: growth = copy to new location = wasted space.\n\nHard limit (wc3 / Jass native target): the shared store is a fixed-size array, so it is\nbounded by JASS_MAX_ARRAY_SIZE total slots per type across all live instances; exceeding\nit raises an error. On the Lua target the store is a dynamically growing table, so the\ncap does not apply - allocateStorage branches on the magic isLua constant and skips the\nerror. ArrayList's added value on Lua is keeping element types static instead of relying\non typecasting.",
"summaryFirstLine": "High-performance array-based list using static shared storage per type.",
"tags": [
"collection",
"data",
"list"
],
"imports": [],
"entities": [
{
"kind": "class",
"name": "ArrayList",
"typeParams": "<T:>",
"receiver": null,
"signature": "public class ArrayList<T:>",
"doc": "",
"deprecated": {
"flag": false,
"message": null
},
"configurable": false,
"members": [],
"enumMembers": [],
"line": 98
},
{
"kind": "function",
"name": "asArrayList",
"typeParams": "<T:>",
"receiver": null,
"signature": "public function asArrayList<T:>(vararg T ts) returns ArrayList<T>",
"doc": "",
"deprecated": {
"flag": false,
"message": null
},
"configurable": false,
"members": [],
"enumMembers": [],
"line": 610
},
{
"kind": "interface",
"name": "ArrayListPredicate",
"typeParams": "<T:>",
"receiver": null,
"signature": "public interface ArrayListPredicate<T:>",
"doc": "",
"deprecated": {
"flag": false,
"message": null
},
"configurable": false,
"members": [],
"enumMembers": [],
"line": 620
},
{
"kind": "interface",
"name": "ALItrClosure",
"typeParams": "<T:>",
"receiver": null,
"signature": "public interface ALItrClosure<T:>",
"doc": "",
"deprecated": {
"flag": false,
"message": null
},
"configurable": false,
"members": [],
"enumMembers": [],
"line": 623
},
{
"kind": "interface",
"name": "ArrayListUpdater",
"typeParams": "<T:>",
"receiver": null,
"signature": "public interface ArrayListUpdater<T:>",
"doc": "",
"deprecated": {
"flag": false,
"message": null
},
"configurable": false,
"members": [],
"enumMembers": [],
"line": 626
},
{
"kind": "interface",
"name": "MapClosure",
"typeParams": "<T:, Q:>",
"receiver": null,
"signature": "public interface MapClosure<T:, Q:>",
"doc": "",
"deprecated": {
"flag": false,
"message": null
},
"configurable": false,
"members": [],
"enumMembers": [],
"line": 629
},
{
"kind": "interface",
"name": "FoldClosure",
"typeParams": "<T:, Q:>",
"receiver": null,
"signature": "public interface FoldClosure<T:, Q:>",
"doc": "",
"deprecated": {
"flag": false,
"message": null
},
"configurable": false,
"members": [],
"enumMembers": [],
"line": 632
},
{
"kind": "interface",
"name": "Comparator",
"typeParams": "<T:>",
"receiver": null,
"signature": "public interface Comparator<T:>",
"doc": "",
"deprecated": {
"flag": false,
"message": null
},
"configurable": false,
"members": [],
"enumMembers": [],
"line": 635
},
{
"kind": "extension-function",
"name": "sort",
"typeParams": "",
"receiver": "ArrayList<int>",
"signature": "public function ArrayList<int>.sort()",
"doc": "",
"deprecated": {
"flag": false,
"message": null
},
"configurable": false,
"members": [],
"enumMembers": [],
"line": 643
},
{
"kind": "extension-function",
"name": "sort",
"typeParams": "",
"receiver": "ArrayList<real>",
"signature": "public function ArrayList<real>.sort()",
"doc": "",
"deprecated": {
"flag": false,
"message": null
},
"configurable": false,
"members": [],
"enumMembers": [],
"line": 647
},
{
"kind": "extension-function",
"name": "sort",
"typeParams": "",
"receiver": "ArrayList<string>",
"signature": "public function ArrayList<string>.sort()",
"doc": "",
"deprecated": {
"flag": false,
"message": null
},
"configurable": false,
"members": [],
"enumMembers": [],
"line": 651
},
{
"kind": "extension-function",
"name": "joinBy",
"typeParams": "",
"receiver": "ArrayList<string>",
"signature": "public function ArrayList<string>.joinBy(string separator) returns string",
"doc": "Joins elements from a string list into one string using a separator",
"deprecated": {
"flag": false,
"message": null
},
"configurable": false,
"members": [],
"enumMembers": [],
"line": 659
},
{
"kind": "extension-function",
"name": "join",
"typeParams": "",
"receiver": "ArrayList<string>",
"signature": "public function ArrayList<string>.join() returns string",
"doc": "Joins elements from a string list into one string",
"deprecated": {
"flag": false,
"message": null
},
"configurable": false,
"members": [],
"enumMembers": [],
"line": 668
},
{
"kind": "extension-function",
"name": "op_index",
"typeParams": "<T>",
"receiver": "ArrayList<T>",
"signature": "public function ArrayList<T>.op_index<T>(int index) returns T",
"doc": "",
"deprecated": {
"flag": false,
"message": null
},
"configurable": false,
"members": [],
"enumMembers": [],
"line": 672
},
{
"kind": "extension-function",
"name": "op_indexAssign",
"typeParams": "<T>",
"receiver": "ArrayList<T>",
"signature": "public function ArrayList<T>.op_indexAssign<T>(int index, T value)",
"doc": "",
"deprecated": {
"flag": false,
"message": null
},
"configurable": false,
"members": [],
"enumMembers": [],
"line": 675
}
]
},
{
"package": "BitSet",
"category": "data",
Expand Down Expand Up @@ -154542,7 +154285,40 @@
"message": null
},
"configurable": false,
"members": [],
"members": [
{
"kind": "function",
"name": "commandButton",
"typeParams": "",
"receiver": null,
"signature": "static function commandButton(int index) returns string",
"doc": "Name of a command card button, index 0 to 11 (1.32+): 0 is the top-left (0,0) button, 11 the\n\t\tbottom-right (3,2). Move/hide via these named frames, not ORIGIN_FRAME_COMMAND_BUTTON (moving\n\t\tthe origin frames glitches in 1.32+). NOTE: command buttons reappear/update on every unit\n\t\tselection, even while hidden via BlzHideOriginFrames - re-hide on selection if needed.",
"deprecated": {
"flag": false,
"message": null
},
"configurable": false,
"members": [],
"enumMembers": [],
"line": 103
},
{
"kind": "function",
"name": "inventoryButton",
"typeParams": "",
"receiver": null,
"signature": "static function inventoryButton(int index) returns string",
"doc": "Name of an inventory item button, index 0 to 5 (1.32+). Move/hide via these named frames, not\n\t\tORIGIN_FRAME_ITEM_BUTTON (moving the origin frames glitches in 1.32+). NOTE: like command\n\t\tbuttons, they reappear/update on every unit selection.",
"deprecated": {
"flag": false,
"message": null
},
"configurable": false,
"members": [],
"enumMembers": [],
"line": 268
}
],
"enumMembers": [],
"line": 58
},
Expand All @@ -154560,7 +154336,7 @@
"configurable": false,
"members": [],
"enumMembers": [],
"line": 476
"line": 525
}
]
},
Expand Down
12 changes: 12 additions & 0 deletions _doc/stdlib/ref/_wurst/FramehandleNames.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,18 @@ public class FramehandleDefaultNames
These default frames can be obtained with getFrameByName(..) [BlzGetFrameByName]
(the createContext (subframe-id) parameter is by default 0, some frames does contain subframes)

**Members:**

- `static function commandButton(int index) returns string`
Name of a command card button, index 0 to 11 (1.32+): 0 is the top-left (0,0) button, 11 the
bottom-right (3,2). Move/hide via these named frames, not ORIGIN_FRAME_COMMAND_BUTTON (moving
the origin frames glitches in 1.32+). NOTE: command buttons reappear/update on every unit
selection, even while hidden via BlzHideOriginFrames - re-hide on selection if needed.
- `static function inventoryButton(int index) returns string`
Name of an inventory item button, index 0 to 5 (1.32+). Move/hide via these named frames, not
ORIGIN_FRAME_ITEM_BUTTON (moving the origin frames glitches in 1.32+). NOTE: like command
buttons, they reappear/update on every unit selection.

### FramehandleNames

```wurst
Expand Down
Loading