<?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_set" xml:lang="en-US">
<title>listSet</title>
<indexterm><primary>listSet</primary></indexterm>
<section xml:id="_md_docs_2list_2list_set_1autotoc_md408">
<title>autotoc_md408</title>
<para>title: ArmaRAMDb - List Set icon: mdi:file-text-outline </para>
</section>
<section xml:id="_md_docs_2list_2list_set_1autotoc_md409">
<title>excerpt: Set an element in a list stored at a key in RAMDb.</title></section>
<section xml:id="_md_docs_2list_2list_set_1autotoc_md410">
<title>ramdb_db_fnc_listSet</title><section xml:id="_md_docs_2list_2list_set_1autotoc_md411">
<title>Description</title>
<para>Updates or sets the value of a specific element at a given index in a list stored at a specified key in the RAMDb database. This function allows for precise modification of list contents by targeting individual elements without affecting other elements in the list. It is particularly useful for updating record information, modifying configuration data, or correcting entries.</para>
</section>
<section xml:id="_md_docs_2list_2list_set_1autotoc_md412">
<title>Syntax</title>
<para><literallayout><computeroutput>[_key,&#32;_index,&#32;_data]&#32;call&#32;ramdb_db_fnc_listSet
</computeroutput></literallayout></para>
</section>
<section xml:id="_md_docs_2list_2list_set_1autotoc_md413">
<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>_key   </para>
</entry><entry>
<para>String   </para>
</entry><entry>
<para>The key identifying the list in which to set an element   </para>
</entry><entry>
<para>&quot;&quot;    </para>
</entry></row>
      <row  class='markdownTableRowEven'>
<entry>
<para>_index   </para>
</entry><entry>
<para>Number   </para>
</entry><entry>
<para>The zero-based index of the element to set in the list   </para>
</entry><entry>
<para>-1    </para>
</entry></row>
      <row  class='markdownTableRowOdd'>
<entry>
<para>_data   </para>
</entry><entry>
<para>Array/String/Number/Boolean   </para>
</entry><entry>
<para>The value to set at the specified index   </para>
</entry><entry>
<para>[]   </para>
</entry></row>
    </tbody>
    </tgroup>
</informaltable>
</para>
</section>
<section xml:id="_md_docs_2list_2list_set_1autotoc_md414">
<title>Return Value</title>
<para>None. The operation runs synchronously to update the element immediately.</para>
</section>
<section xml:id="_md_docs_2list_2list_set_1autotoc_md415">
<title>Examples</title>
<para><emphasis role="bold">Update an event log entry:</emphasis> <literallayout><computeroutput>[&quot;eventLog&quot;,&#32;0,&#32;[&quot;Updated&#32;event&#32;information&quot;]]&#32;call&#32;ramdb_db_fnc_listSet;
</computeroutput></literallayout></para>

<para><emphasis role="bold">Modify player statistics:</emphasis> <literallayout><computeroutput>[&quot;playerStats&quot;,&#32;3,&#32;[name&#32;player,&#32;score&#32;player,&#32;alive&#32;player]]&#32;call&#32;ramdb_db_fnc_listSet;
</computeroutput></literallayout></para>

<para><emphasis role="bold">Update configuration in multiplayer:</emphasis> <literallayout><computeroutput>[&quot;missionConfig&quot;,&#32;1,&#32;[&quot;difficulty&quot;,&#32;&quot;veteran&quot;]]&#32;remoteExecCall&#32;[&quot;ramdb_db_fnc_listSet&quot;,&#32;2,&#32;false];
</computeroutput></literallayout></para>
</section>
<section xml:id="_md_docs_2list_2list_set_1autotoc_md416">
<title>Notes</title>
<para><itemizedlist>
<listitem>
<para>This function updates only the element at the specified index. All other elements remain unchanged.</para>
</listitem><listitem>
<para>The index is zero-based, meaning the first element is at index 0, the second at index 1, and so on.</para>
</listitem><listitem>
<para>If the specified index does not exist in the list, the operation may fail or have no effect.</para>
</listitem><listitem>
<para>Both the <computeroutput>_key</computeroutput> parameter and <computeroutput>_data</computeroutput> parameter must be valid (non-empty string for key, non-nil for data), otherwise the function will exit without performing any action.</para>
</listitem><listitem>
<para>The function supports various data types, including arrays, strings, numbers, and booleans.</para>
</listitem><listitem>
<para>The update operation is permanent and will overwrite any previous value at the specified index.</para>
</listitem><listitem>
<para>All list operations are logged for debugging purposes.</para>
</listitem></itemizedlist>
</para>
</section>
<section xml:id="_md_docs_2list_2list_set_1autotoc_md417">
<title>Related Functions</title>
<para><itemizedlist>
<listitem>
<para><computeroutput>ramdb_db_fnc_listAdd</computeroutput>: Adds an element to a list</para>
</listitem><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_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_set_1autotoc_md418">
<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>
