- Joined
- Jan 30, 2013
- Messages
- 12,440
Smells like data structure just get plugged into GUI world.
Ordered Iterateable Lists:
Each list has a unique ID that is an integer generated by GMUI. You will need this ID to manipulate the lists and destroy them when you don't need them anymore.
As for the "Lists_Hashtable" hashtable, you can use the unique ID of any GIOL list as a child hashtable. The size of a list is stored in the address 0, while the data is stored in the positive addresses. Therefore, you can use negative addresses for your own purposes.
Hashtable addresses:
0: Size of List
Positive Integers: List Data
Lists_ListID | The ID of the list we want to add data to. |
Lists_Instance | We set this to zero because we want to add data, not remove it. |
Lists_Data | The Data we want to add to the list. |
Lists_ListID | Same as before. |
Lists_Instance | The index of the data added to the list (equal to list's size). |
Lists_Data | Same as before. |
Lists_ListID | The ID of the list we want to remove data from. |
Lists_Instance | The index of the data we want to remove from the list. |
Lists_ListID | Same as before. |
Lists_Instance | Same as before. |
Lists_ListID | We set this to zero because we want to create a new list. |
Lists_ListID | The ID of our newly created list. |
Lists_ListID | The ID of the list we want to destroy. |
Lists_ListID | Same as before. |
Lists_ID | The ID of the list you want to iterate over. |
Lists_Trigger | The trigger that should be executed for each element. |
Lists_LoopUntil | How many elements should the loop iterate over before it stops |
Lists_ID | The ID of the list being iterated over. |
Lists_Instance | The current index of the iteration. |
Lists_LoopUntil | The data stored in the index of the list. |
Lists_ID | The ID of the list you want to know the size of |
YourIntegerVariable | The variable that will hold the size of the list. |
//Please note that list indices are in the range of 1 to the maximum integer value
//==============================================
// System API
//==============================================
//==============
//Getters and Setters
//Gets data in specified index of a list
//Available since 2.0.0
function GIOL_Get takes integer listKey, integer index returns integer
endfunction
//Gets the size of a specified list
//Available since 2.0.0, replaced GetListSize
function GIOL_SizeOf takes integer listKey returns integer
endfunction
//Sets the value stored inside a specified index
//Available since 2.0.0
function GIOL_Set takes integer listKey, integer index, integer data returns nothing
endfunction
//Adds data to the end of a list and returns the index the data was added at (equal to size of the list)
//Available since 2.0.0, replaced GIUL_AddData
function GIOL_Append takes integer listKey, integer data returns integer
endfunction
//Removes data from a certain index of a List
//Available since 2.0.0, replaced RemoveData
function GIOL_Remove takes integer listKey, integer instance returns nothing
endfunction
//==============
//List creation and destruction
//Creates a list and returns its list key/list ID
function GIOL_CreateList takes nothing returns integer
endfunction
//Destroys the specified list
function GIOL_DestroyList takes integer listKey returns nothing
endfunction
//==============
//Looping functionality
//======
//Functions for simplified looping
//Returns the next index of a list. If the index is 0, the end of the list has been reached.
//If you are using this function to loop, you should NOT use GIOL_Remove!
//Available since 2.0.0
function GIOL_Next takes integer listKey returns integer
endfunction
//If you are iterating over a list using a GIUL_Next loop, you can use this function to remove the
//element in the index that you are currently at.
//Available since 2.0.0
endfunction
//Loop example using GIOL_Next:
loop
set index = GIOL_Next(mylist)
exitwhen index == 0
//...do stuff...
endloop
//======
//Functions for code/trigger loops
//Loops over a list and executes the given trigger
//Stops after it enconters "until" number of elements
//If a negative "until" is specified, it will only stop when there are no more elements
//Sets the udg_Lists_Data, Instance and ListID variables to their correct values each time before running the trigger
function GIOL_ForEachCounted takes integer listKey, trigger trig, integer until returns nothing
endfunction
function GIOL_ForEach takes integer listKey, trigger trig returns nothing
endfunction
//Same as GIOL_Loop, but executes the given code in a ForPlayer loop, instead of a trigger
//Added in version 1.1.0
function GIOL_ForEachCodeCounted takes integer listKey, code func, integer until returns nothing
endfunction
function GIOL_ForEachCode takes integer listKey, code func returns nothing
endfunction
//==============
//System Initialization
//Initialzies GIOL if it has not been initialized
function GIOL_Initialize takes nothing returns nothing
endfunction
Unordered Iterateable Lists:
Each list has a unique ID that is an integer generated by GMUI. You will need this ID to manipulate the lists and destroy them when you don't need them anymore.
As for the "GIUL_Hashtable" hashtable, you can use the unique ID of any GIUL list as a child hashtable. The size of a list is stored in the address 0, while the data is stored in the positive addresses. Therefore, you can use negative addresses for your own purposes.
Hashtable addresses:
0: Size of List
Positive Integers: List Data
Lists_ListID | The ID of the list we want to add data to. |
Lists_Instance | We set this to zero because we want to add data, not remove it. |
Lists_Data | The Data we want to add to the list. |
Lists_ListID | Same as before. |
Lists_Instance | Index of the added data (equal to size of list) |
Lists_Data | Same as before. |
Lists_ListID | The ID of the list we want to remove data from. |
Lists_Instance | The index of the data we want to remove from the list. |
Lists_ListID | Same as before. |
Lists_Instance | Same as before. |
Lists_ListID | We set this to zero because we want to create a new list. |
Lists_ListID | The ID of our newly created list. |
Lists_ListID | The ID of the list we want to destroy. |
Lists_ListID | Same as before. |
Lists_ID | The ID of the list you want to iterate over. |
Lists_Trigger | The trigger that should be executed for each element. |
Lists_LoopUntil | How many elements should the loop iterate over before it stops |
Lists_ID | The ID of the list being iterated over. |
Lists_Instance | The current index of the iteration. |
Lists_LoopUntil | The data stored in the index of the list. |
Lists_ID | The ID of the list you want to know the size of |
YourIntegerVariable | The variable that will hold the size of the list. |
//Please note that list indices are in the range of 1 to the maximum integer value
//==============================================
// System API
//==============================================
//==============
//Getters and Setters
//Gets data in specified index of a list
//Available since 2.0.0
function GIUL_Get takes integer listKey, integer index returns integer
endfunction
//Gets the size of a specified list
//Available since 2.0.0, replaced GetListSize
function GIUL_SizeOf takes integer listKey returns integer
endfunction
//Sets the value stored inside a specified index
//Available since 2.0.0
function GIUL_Set takes integer listKey, integer index, integer data returns nothing
endfunction
//==============
//Getters and Setters
//Adds data to the end of a list and returns the index the data was added at (equal to size of the list)
//Available since 2.0.0, replaced GIUL_AddData
function GIUL_Append takes integer listKey, integer data returns integer
endfunction
//Removes data from a certain index of a List
//Available since 2.0.0, replaced RemoveData
function GIUL_Remove takes integer listKey, integer index returns nothing
endfunction
//==============
//List creation and destruction
//Creates a new list and returns its ID
function GIUL_CreateList takes nothing returns integer
endfunction
//Destroys the specified list
function GIUL_DestroyList takes integer listKey returns nothing
endfunction
//==============
//Looping functionality
//======
//Functions for simplified looping
//Returns the next index of a list. If the index is 0, the end of the list has been reached.
//If you are using this function to loop, you should NOT use GIUL_Remove!
//Available since 2.0.0
function GIUL_Next takes integer listKey returns integer
endfunction
//If you are iterating over a list using a GIUL_Next loop, you can use this function to remove the
//element in the index that you are currently at.
//Available since 2.0.0
function GIUL_RemoveCurrent takes integer listKey returns nothing
endfunction
//Loop example using GIUL_Next:
loop
set index = GIUL_Next(mylist)
exitwhen index == 0
//...do stuff...
endloop
//======
//Functions for code/trigger loops
//Loops over a list and executes the given trigger
//Stops after it enconters "until" number of elements
//If a negative "until" is specified, it will only stop when there are no more elements
//Sets the udg_Lists_Data, Instance and listKey variables to their correct values each time before running the trigger
function GIUL_ForEachCounted takes integer listKey, trigger trig, integer until returns nothing
endfunction
function GIUL_ForEach takes integer listKey, trigger trig returns nothing
endfunction
//Same as GIUL_Loop, but executes the given code in a ForPlayer loop, instead of a trigger
//Added in version 1.1.0
function GIUL_ForEachCodeCounted takes integer listKey, code func, integer until returns nothing
endfunction
function GIUL_ForEachCode takes integer listKey, code func returns nothing
endfunction
//==============
//System Initialization
//Initializes GIUL if it has not yet been initialized.
function GIUL_Initialize takes nothing returns nothing
endfunction
Command | Action |
kill | Kills and removes from the game your selected units. |
add | Adds your selected units to a list |
kill all | Kills all the units on the list created by the "add" command. |