ArraySet()
In an one-dimensional array, sets the elements in a specified index range to a value.
Useful for initializing an array after a call to ArrayNew.
ArraySet( array=array, start_pos=number, end_pos=number, value=any );
Returns: Boolean
Examples
Sets a range of array positions to a value
newArray = arrayNew(1);
<span class="nf">arraySet</span><span class="p">(</span><span class="nv">newArray</span><span class="p">,</span> <span class="m">1</span><span class="p">,</span> <span class="m">4</span><span class="p">,</span> <span class="s2">"All is well"</span><span class="p">);</span>
<span class="nf">dump</span><span class="p">(</span><span class="nv">newArray</span><span class="p">);</span>
<span class="c">// member function</span>
<span class="nf">newArray.set</span><span class="p">(</span><span class="m">1</span><span class="p">,</span><span class="m">2</span><span class="p">,</span><span class="s2">"lets change it"</span><span class="p">);</span>
<span class="nf">dump</span><span class="p">(</span><span class="nv">newArray</span><span class="p">);</span>
See also
- Arrays
- array.set()
- Search Issue Tracker
- Search Lucee Test Cases (good for further, detailed examples)