the insertion index and the element
the same element
| |
|
|
| |
Implementation
01 function insert( index, element )
02 if( ( index < 0 ) or ( index >= pointer + 1 ) ) then
03 insert = vbnull
04 exit function
05 else
06 pointer = pointer + 1
07
08 call autosize( )
09
10 dim skip: skip = pointer
11 do while( skip > index )
12 if( isobject( elements( skip - 1 ) ) ) then
13 set elements( skip ) = elements( skip - 1 )
14 else
15 elements( skip ) = elements( skip - 1 )
16 end if
17 skip = skip - 1
18 loop
19
20 if( isobject( element ) ) then
21 set elements( index ) = element
22 set insert = element
23 else
24 elements( index ) = element
25 insert = element
26 end if
27 end if
28 end function
|
|
| |
|
|
|