<?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_2basic_2set" xml:lang="en-US">
<title>set</title>
<indexterm><primary>set</primary></indexterm>
<section xml:id="_md_docs_2basic_2set_1autotoc_md67">
<title>autotoc_md67</title>
<para>title: ArmaRAMDb - Set Key icon: mdi:file-text-outline </para>
</section>
<section xml:id="_md_docs_2basic_2set_1autotoc_md68">
<title>excerpt: Set the value of stored key from RAMDb.</title></section>
<section xml:id="_md_docs_2basic_2set_1autotoc_md69">
<title>ramdb_db_fnc_set</title><section xml:id="_md_docs_2basic_2set_1autotoc_md70">
<title>Description</title>
<para>Stores a value in the database with the specified key. This function allows saving various data types (arrays, strings, numbers, or booleans) that can be retrieved later using the key.</para>
</section>
<section xml:id="_md_docs_2basic_2set_1autotoc_md71">
<title>Syntax</title>
<para><literallayout><computeroutput>[_key,&#32;_data]&#32;call&#32;ramdb_db_fnc_set
</computeroutput></literallayout></para>
</section>
<section xml:id="_md_docs_2basic_2set_1autotoc_md72">
<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 key to store the data under   </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 store in the database   </para>
</entry><entry>
<para>[]   </para>
</entry></row>
    </tbody>
    </tgroup>
</informaltable>
</para>
</section>
<section xml:id="_md_docs_2basic_2set_1autotoc_md73">
<title>Return Value</title>
<para>None. The operation runs asynchronously.</para>
</section>
<section xml:id="_md_docs_2basic_2set_1autotoc_md74">
<title>Examples</title><section xml:id="_md_docs_2basic_2set_1autotoc_md75">
<title>Store a simple array:</title>
<para><literallayout><computeroutput>[&quot;playerInventory&quot;,&#32;[&quot;item1&quot;,&#32;&quot;item2&quot;,&#32;&quot;item3&quot;]]&#32;call&#32;ramdb_db_fnc_set;
</computeroutput></literallayout></para>
</section>
<section xml:id="_md_docs_2basic_2set_1autotoc_md76">
<title>Store player data under their UID:</title>
<para><literallayout><computeroutput>[getPlayerUID&#32;player,&#32;[name&#32;player,&#32;getPos&#32;player,&#32;getAllGear&#32;player]]&#32;call&#32;ramdb_db_fnc_set;
</computeroutput></literallayout></para>
</section>
<section xml:id="_md_docs_2basic_2set_1autotoc_md77">
<title>Call the set function remotely from a client:</title>
<para><literallayout><computeroutput>[&quot;serverSetting&quot;,&#32;[true,&#32;30,&#32;&quot;normal&quot;]]&#32;remoteExecCall&#32;[&quot;ramdb_db_fnc_set&quot;,&#32;2,&#32;false];
</computeroutput></literallayout></para>
</section>
</section>
<section xml:id="_md_docs_2basic_2set_1autotoc_md78">
<title>Notes</title>
<para><itemizedlist>
<listitem>
<para>The function validates both the key and data before attempting to store</para>
</listitem><listitem>
<para>If the key already exists, its value will be overwritten</para>
</listitem><listitem>
<para>Complex data structures should be serialized into arrays</para>
</listitem><listitem>
<para>There are no size limits for data, but extremely large values might impact performance</para>
</listitem><listitem>
<para>For structured data, consider using hash tables instead of key-value pairs</para>
</listitem></itemizedlist>
</para>
</section>
<section xml:id="_md_docs_2basic_2set_1autotoc_md79">
<title>Related Functions</title>
<para><itemizedlist>
<listitem>
<para><computeroutput>ramdb_db_fnc_get</computeroutput>: Retrieves a value by key</para>
</listitem><listitem>
<para><computeroutput>ramdb_db_fnc_delete</computeroutput>: Removes a value by key</para>
</listitem><listitem>
<para><computeroutput>ramdb_db_fnc_scheduler</computeroutput>: Processes the callback response</para>
</listitem></itemizedlist>
</para>
</section>
<section xml:id="_md_docs_2basic_2set_1autotoc_md80">
<title>Links</title>
<para><link linkend="_md_docs_2basic_2delete">Delete Key</link> | <link linkend="_md_docs_2basic_2get">Get Key</link> | <link linkend="_md_docs_2basic_2set">Set Key</link> </para>
</section>
</section>
</section>
