<?xml version='1.0' encoding='UTF-8' standalone='no'?>
<section xmlns="http://docbook.org/ns/docbook" version="5.0" xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="_md_docs_2list_2list_add" xml:lang="en-US">
<title>listAdd</title>
<indexterm><primary>listAdd</primary></indexterm>
<section xml:id="_md_docs_2list_2list_add_1autotoc_md347">
<title>autotoc_md347</title>
<para>title: ArmaRAMDb - List Add icon: mdi:file-text-outline </para>
</section>
<section xml:id="_md_docs_2list_2list_add_1autotoc_md348">
<title>excerpt: Add element to list stored at key from RAMDb.</title></section>
<section xml:id="_md_docs_2list_2list_add_1autotoc_md349">
<title>ramdb_db_fnc_listAdd</title><section xml:id="_md_docs_2list_2list_add_1autotoc_md350">
<title>Description</title>
<para>Adds an element to a list stored in the database under the specified key. This function appends values to an existing list or creates a new list if it doesn&apos;t exist. It&apos;s particularly useful for logging, event tracking, or maintaining collections of data that grow over time.</para>
</section>
<section xml:id="_md_docs_2list_2list_add_1autotoc_md351">
<title>Syntax</title>
<para><literallayout><computeroutput>[_key,&#32;_data]&#32;call&#32;ramdb_db_fnc_listAdd
</computeroutput></literallayout></para>
</section>
<section xml:id="_md_docs_2list_2list_add_1autotoc_md352">
<title>Parameters</title>
<para><informaltable frame="all">
    <tgroup cols="4" align="left" colsep="1" rowsep="1">
      <colspec colname='c1'/>
      <colspec colname='c2'/>
      <colspec colname='c3'/>
      <colspec colname='c4'/>
<thead>
      <row  class='markdownTableHead'>
<entry>
<para>Parameter   </para>
</entry><entry>
<para>Type   </para>
</entry><entry>
<para>Description   </para>
</entry><entry>
<para>Default    </para>
</entry></row>
</thead><tbody>
      <row  class='markdownTableRowOdd'>
<entry>
<para><computeroutput>_key</computeroutput>   </para>
</entry><entry>
<para>String   </para>
</entry><entry>
<para>Name of the list to add the element to   </para>
</entry><entry>
<para>&quot;&quot;    </para>
</entry></row>
      <row  class='markdownTableRowEven'>
<entry>
<para><computeroutput>_data</computeroutput>   </para>
</entry><entry>
<para>Array, String, Number, or Boolean   </para>
</entry><entry>
<para>The value to insert into the list   </para>
</entry><entry>
<para>[]   </para>
</entry></row>
    </tbody>
    </tgroup>
</informaltable>
</para>
</section>
<section xml:id="_md_docs_2list_2list_add_1autotoc_md353">
<title>Return Value</title>
<para>None. The operation runs synchronously to add the element to the list.</para>
</section>
<section xml:id="_md_docs_2list_2list_add_1autotoc_md354">
<title>Examples</title><section xml:id="_md_docs_2list_2list_add_1autotoc_md355">
<title>Add an event log entry:</title>
<para><literallayout><computeroutput>[&quot;events&quot;,&#32;[&quot;Server&#32;state&#32;saved&#32;to&#32;DB&#32;&quot;&#32;+&#32;systemTimeUTC]]&#32;call&#32;ramdb_db_fnc_listAdd;
</computeroutput></literallayout></para>
</section>
<section xml:id="_md_docs_2list_2list_add_1autotoc_md356">
<title>Add a player message:</title>
<para><literallayout><computeroutput>[&quot;messages&quot;,&#32;[name&#32;player&#32;+&#32;&quot;:&#32;&quot;&#32;+&#32;_messageText]]&#32;call&#32;ramdb_db_fnc_listAdd;
</computeroutput></literallayout></para>
</section>
<section xml:id="_md_docs_2list_2list_add_1autotoc_md357">
<title>Add data from a client:</title>
<para><literallayout><computeroutput>[&quot;playerActions&quot;,&#32;[getPlayerUID&#32;player,&#32;name&#32;player,&#32;&quot;logged&#32;in&quot;]]&#32;remoteExecCall&#32;[&quot;ramdb_db_fnc_listAdd&quot;,&#32;2,&#32;false];
</computeroutput></literallayout></para>
</section>
</section>
<section xml:id="_md_docs_2list_2list_add_1autotoc_md358">
<title>Notes</title>
<para><itemizedlist>
<listitem>
<para>Elements are added to the end of the list in the order they are inserted</para>
</listitem><listitem>
<para>If the list doesn&apos;t exist, it will be created automatically</para>
</listitem><listitem>
<para>Both the key and data parameters are required and validated</para>
</listitem><listitem>
<para>Lists can store various data types (arrays, strings, numbers, or booleans)</para>
</listitem><listitem>
<para>Useful for maintaining a history of events, logs, or sequential data</para>
</listitem><listitem>
<para>The operation is executed immediately and synchronously</para>
</listitem><listitem>
<para>New elements are always added to the end of the list</para>
</listitem><listitem>
<para>All operations are logged for debugging purposes</para>
</listitem></itemizedlist>
</para>
</section>
<section xml:id="_md_docs_2list_2list_add_1autotoc_md359">
<title>Related Functions</title>
<para><itemizedlist>
<listitem>
<para><computeroutput>ramdb_db_fnc_listGet</computeroutput>: Retrieves a specific element from a list</para>
</listitem><listitem>
<para><computeroutput>ramdb_db_fnc_listLoad</computeroutput>: Retrieves a range of elements from a list</para>
</listitem><listitem>
<para><computeroutput>ramdb_db_fnc_listSet</computeroutput>: Replaces a specific element in a list</para>
</listitem><listitem>
<para><computeroutput>ramdb_db_fnc_listRemove</computeroutput>: Removes a specific element from a list</para>
</listitem><listitem>
<para><computeroutput>ramdb_db_fnc_listDelete</computeroutput>: Deletes an entire list</para>
</listitem><listitem>
<para><computeroutput>ramdb_db_fnc_scheduler</computeroutput>: Processes the callback from the database extension</para>
</listitem></itemizedlist>
</para>
</section>
<section xml:id="_md_docs_2list_2list_add_1autotoc_md360">
<title>Links</title>
<para><link linkend="_md_docs_2list_2list_add">List Add</link> | <link linkend="_md_docs_2list_2list_delete">List Delete</link> | <link linkend="_md_docs_2list_2list_get">List Get</link> | <link linkend="_md_docs_2list_2list_load">List Load</link> | <link linkend="_md_docs_2list_2list_remove">List Remove</link> | <link linkend="_md_docs_2list_2list_set">List Set</link> </para>
</section>
</section>
</section>
