<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.frictionalgames.com/page?action=history&amp;feed=atom&amp;title=Hpl2%3AResources%3Ascript_modules%3Astringlist</id>
	<title>Hpl2:Resources:script modules:stringlist - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.frictionalgames.com/page?action=history&amp;feed=atom&amp;title=Hpl2%3AResources%3Ascript_modules%3Astringlist"/>
	<link rel="alternate" type="text/html" href="https://wiki.frictionalgames.com/page?title=Hpl2:Resources:script_modules:stringlist&amp;action=history"/>
	<updated>2026-05-14T06:44:37Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.34.2</generator>
	<entry>
		<id>https://wiki.frictionalgames.com/page?title=Hpl2:Resources:script_modules:stringlist&amp;diff=757&amp;oldid=prev</id>
		<title>Maintenance script: Upload from wiki</title>
		<link rel="alternate" type="text/html" href="https://wiki.frictionalgames.com/page?title=Hpl2:Resources:script_modules:stringlist&amp;diff=757&amp;oldid=prev"/>
		<updated>2020-07-09T13:48:20Z</updated>

		<summary type="html">&lt;p&gt;Upload from wiki&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;= String List =&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The StringList module provides a basic List data structure implementation, in a way which will not leak variables, and is non-volatile when saving (I.e. saved when the game is).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Downloads ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
''' [http://pastebin.com/EPi29tys Stripped ] (Reccommended) - A compact version with minimal documentation (just section headers).&lt;br /&gt;
''' [http://pastebin.com/3H2Wppvd|Full]] - A version with all documentation included in the source file. Assumes use of [[http://wiki.frictionalgames.com/hpl2/resources/improvnotepad Apjjm's Improved Notepad++ HPS Support]&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
''' Copy and paste the desired script into your script file.&lt;br /&gt;
''' '''OR '''  save the script as an internal file and use an &amp;quot;#include filename.ext&amp;quot; with a [http://wiki.frictionalgames.com/hpl2/resources/preprocess Pre-Processer].&lt;br /&gt;
== List Management ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
bool stringListCreate(string &amp;amp;in asName)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Creates a stringList with the given name. Returns true if the list was created successfully (no other lists with the same name).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
bool stringListDestroy(string &amp;amp;in asName)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Destroys the list. Note that there will still be one or two empty string variables left after calling this, so creating multiple lists still leaks. Returns true if the destruction was successful (list existed).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
bool stringListExists(string &amp;amp;in asName)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Returns true if the named list exists&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
int stringListSize(string &amp;amp;in asName)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Returns the size of the named list (0 if list is empty or does not exist)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
void stringListClear(string &amp;amp;in asName)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Clears all elements from the list&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Item Management ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
string[] stringListItems(string &amp;amp;in asName)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Returns all items in the named list as a string array. Use this if you wish to acess multiple elements in a list without changing the list.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
int stringListAddItem(string &amp;amp;in asName, string &amp;amp;in asItem)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Adds asItem to the end of the named list. Returns the index of the item added (starting at 0). Returns -1 if the list doesn't exist.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
void stringListAddItems(string &amp;amp;in asName, string[] asItems)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Adds the collection asItems to the end of named list.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
string stringListGetItem(string &amp;amp;in asName, int alIndex)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Gets the item at the given index (alIndex) in the named list. For more than one item acess use array access &amp;amp; stringListItems(asName).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
int stringListGetLastIndexof(string &amp;amp;in asName, string &amp;amp;in asItem)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Gets the index of the last occurance of asItem in the named list. -1 is returned if the item is not in the list (or the list does not exist)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
int stringListGetFirstIndexof(string &amp;amp;in asName, string &amp;amp;in asItem)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Gets the index of the first occurance of asItem in the named list. -1 is returned if the item is not in the list (or the list does not exist)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
bool stringListContains(string &amp;amp;in asName, string &amp;amp;in asItem)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Returns true if the list (provided it exists) contains a specific item.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
bool stringListRemoveItemAt(string &amp;amp;in asName, uint alIndex)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Remove the item at the given index from the specified list. Returns true if an item was removed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
int stringListRemoveItems(string &amp;amp;in asName, string asItem)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Removes all items from the given list with the specified name. Returns 0 if no items match or the list does not exist. To remove a single item from the list combine stringListRemoveItemAt and stringListGetFirstIndexof&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Constants ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You may need to change the constants below if you wish to alter the list delimeter or the prefix of the list variable names.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;const string _STRLPFX = &amp;quot;_!strli!_&amp;quot;; //Prefixed to all stringList var names - Change this if you get a naming conflict&lt;br /&gt;
const string _STRLDLM = &amp;quot;\0&amp;quot;;    //SINGLE CHARACTER Delimiter for items in the list. This character may not be used in any item strings.&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Maintenance script</name></author>
		
	</entry>
</feed>