Difference between revisions of "Manual:DIL Manual/integerlist"

From DikuMUD Wiki
Jump to navigation Jump to search
(XML import)
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
==Intlist==
+
<span id="intlist"></span>
Intlists are an array of integer types. They can be set directly as follows:
+
  '''Intlist:'''
  
===Example===
+
  Intlists are an array of integer types.  They can be set directly as follows:
  wpn:={5,3,6,9,3,9};
 
  
The intlists can be accessed in the same way stringlist are accessed as follows.
+
'''Example'''
  
===Example===
+
wpn:=
  if (wpn.[5]==5)
+
;
  {
 
    do something
 
  }
 
  
 +
The intlists can be accessed in the same way stringlist are accessed as follows.
 +
 +
'''Example'''
 +
 +
if (wpn.[5]==5)
 
The intlists are saved on savable units.
 
The intlists are saved on savable units.
  
===Example===
+
'''Type:  '''<i><!--CODE-->intlist</i><!--ENDCODE-->
Setting an intlist
+
 
  myintlist:={1,5,9,2,8,5};
+
  This variable type allows you to keep an ordered list of integers with out
  myintlist.[4]:=50;
+
having to create a variable for each integer.
 +
'''Example:'''  <i><!--CODE-->Setting an intlist</i><!--ENDCODE-->
 +
<i><!--CODE-->
 +
---~---~---~---~---~---~---~---~---
 +
 
 +
myintlist:=
 +
;
 +
myintlist.[10]:=50;
 +
 
 +
---~---~---~---~---~---~---~---~---
 +
 
 +
</i><!--ENDCODE-->
 +
 
 +
  If you set a index that is higher then the highest index, every index in
 +
between will be set to zero.  For example if you only have two values in the
 +
intlist and you set index value 10 to 50 all indexes between 2 and 10 will be
 +
set to 0.
 +
'''Example:'''  <i><!--CODE-->Using intlists</i><!--ENDCODE-->
 +
<i><!--CODE-->
 +
---~---~---~---~---~---~---~---~---
 +
 
 +
if (myintlist.[5]==5)
 +
if (myintlist&lt;myint)
 +
i:=0;
 +
ln:=length(myintlist);
 +
while (i&lt;ln)
 +
---~---~---~---~---~---~---~---~---
 +
 
 +
</i><!--ENDCODE-->
 +
'''See Also:'''
 +
[[#bpinsert|Insert]]
 +
[[#bpremove|Remove]]
 +
[[#eptr|Extraptr]]
 +
<span id="intlist"></span>
 +
'''Intlist:'''
 +
 
 +
  Intlists are an array of integer types.  They can be set directly as follows:
 +
 
 +
'''Example'''
 +
 
 +
wpn:=
 +
;
 +
 
 +
The intlists can be accessed in the same way stringlist are accessed as follows.
 +
 
 +
'''Example'''
 +
 
 +
if (wpn.[5]==5)
 +
The intlists are saved on savable units.
 +
 
 +
'''Type:  '''<i><!--CODE-->intlist</i><!--ENDCODE-->
 +
 
 +
  This variable type allows you to keep an ordered list of integers with out
 +
having to create a variable for each integer.
 +
'''Example:'''  <i><!--CODE-->Setting an intlist</i><!--ENDCODE-->
 +
<i><!--CODE-->
 +
---~---~---~---~---~---~---~---~---
 +
 
 +
myintlist:=
 +
;
 +
myintlist.[10]:=50;
  
If you set a index that is higher then the highest index you'll get an OOB error.
+
---~---~---~---~---~---~---~---~---
  
===Example===
+
</i><!--ENDCODE-->
Using intlists
 
  if (myintlist.[5]==5){
 
    stuff
 
  }
 
  
  if (myintlist&lt;myint){
+
  If you set a index that is higher then the highest index, every index in
    stuff
+
between will be set to zero.  For example if you only have two values in the
  }
+
intlist and you set index value 10 to 50 all indexes between 2 and 10 will be
 +
set to 0.
 +
'''Example:'''  <i><!--CODE-->Using intlists</i><!--ENDCODE-->
 +
<i><!--CODE-->
 +
---~---~---~---~---~---~---~---~---
  
  i:=0;
+
if (myintlist.[5]==5)
  ln:=length(myintlist);
+
if (myintlist&lt;myint)
  while (i&lt;ln) {
+
i:=0;
    myintlist.[i]:=i;
+
ln:=length(myintlist);
    i:=i+1;
+
while (i&lt;ln)
  }
+
---~---~---~---~---~---~---~---~---
  
===See Also===
+
</i><!--ENDCODE-->
::[[insert|Insert]]
+
'''See Also:'''
::[[remove|Remove]]
+
[[#bpinsert|Insert]]
::[[extraptr|Extraptr]]
+
[[#bpremove|Remove]]
 +
[[#eptr|Extraptr]]

Latest revision as of 22:30, 4 December 2025

Intlist:
  Intlists are an array of integer types.  They can be set directly as follows:
Example
wpn:=
The intlists can be accessed in the same way stringlist are accessed as follows.
Example
if (wpn.[5]==5)

The intlists are saved on savable units.

Type:  intlist
  This variable type allows you to keep an ordered list of integers with out
having to create a variable for each integer.
Example:  Setting an intlist

---~---~---~---~---~---~---~---~---
myintlist:=
myintlist.[10]:=50;
---~---~---~---~---~---~---~---~---

  If you set a index that is higher then the highest index, every index in
between will be set to zero.  For example if you only have two values in the
intlist and you set index value 10 to 50 all indexes between 2 and 10 will be
set to 0.
Example:  Using intlists

---~---~---~---~---~---~---~---~---
if (myintlist.[5]==5)

if (myintlist<myint) i:=0;

ln:=length(myintlist);
while (i<ln)

---~---~---~---~---~---~---~---~---


See Also:
Insert
Remove
Extraptr

Intlist:
  Intlists are an array of integer types.  They can be set directly as follows:
Example
wpn:=
The intlists can be accessed in the same way stringlist are accessed as follows.
Example
if (wpn.[5]==5)

The intlists are saved on savable units.

Type:  intlist
  This variable type allows you to keep an ordered list of integers with out
having to create a variable for each integer.
Example:  Setting an intlist

---~---~---~---~---~---~---~---~---
myintlist:=
myintlist.[10]:=50;
---~---~---~---~---~---~---~---~---

  If you set a index that is higher then the highest index, every index in
between will be set to zero.  For example if you only have two values in the
intlist and you set index value 10 to 50 all indexes between 2 and 10 will be
set to 0.
Example:  Using intlists

---~---~---~---~---~---~---~---~---
if (myintlist.[5]==5)

if (myintlist<myint) i:=0;

ln:=length(myintlist);
while (i<ln)

---~---~---~---~---~---~---~---~---


See Also:
Insert
Remove
Extraptr