Shop OBEX P1 Docs P2 Docs Learn Events
storing data into an array — Parallax Forums

storing data into an array

ArchiverArchiver Posts: 46,084
edited 2004-07-18 18:49 in General Discussion
Hi stampers,

i want to create a sort of array. It's hard to explain my intentions
but I try to do this by an example:


input=1

1=value1
2=value2
3=value3

*-*-*-*-*-*-*-*-*-*

input=2

1=value4
2=value5
3=value6




So when my input chances by value, the program calls a sort of colum
from the array and gives 1,2 and 3 the values:



array

input | 1 | 2 | 3 |
|
|
|
|
1 |value1 |value2 |value3 |
|
|
|
|
2 |value4 |value5 |value6 |
|
|
|
|
3 |value7 |value8 |value9 |
|
|
|
|
... |value..|value..|value..|


I probiately could do it with branch but I must also be able to
change the contence of the "value.." with pushbuttons so a good
acces of changing the values is a must.

Could anybody help me or give me a link?


kindly regards,


Tim

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2004-07-18 18:49
    Tim-

    The following may get you going in a useful direction:

    LOOKUP INPUTX - 1,[noparse][[/noparse]value(1), value(4), value(7), ...],result1
    LOOKUP INPUTX - 1,[noparse][[/noparse]value(2), value(5), value(8), ...],result2
    LOOKUP INPUTX - 1,[noparse][[/noparse]value(3), value(6), value(9), ...],result3
    ...

    This will assign one of several values to result1, result2 and
    result3 depending on the value of INPUTX (e.g., when INPUTX = 1,
    result1 will be value(1), result2 will be value(2) and result3 will
    be value(3). The contents of the value array can be modified in
    other parts of your program.

    Alternatively, you could use the value of INPUTX and a value
    associated with each desired result to calculate a direct index into
    the array (e.g, result2 = value(INPUTX * 3 - 1).

    Regards,

    Steve

    On 18 Jul 04 at 15:32, ikenniemandanders wrote:

    > Hi stampers,
    >
    > i want to create a sort of array. It's hard to explain my intentions
    > but I try to do this by an example:
    >
    >
    > input=1
    >
    > 1=value1
    > 2=value2
    > 3=value3
    >
    > *-*-*-*-*-*-*-*-*-*
    >
    > input=2
    >
    > 1=value4
    > 2=value5
    > 3=value6
    >
    >
    >
    >
    > So when my input chances by value, the program calls a sort of colum
    > from the array and gives 1,2 and 3 the values:
    >
    >
    >
    > array
    >
    > input | 1 | 2 | 3 |
    >
    |
    |
    |
    |
    > 1 |value1 |value2 |value3 |
    >
    |
    |
    |
    |
    > 2 |value4 |value5 |value6 |
    >
    |
    |
    |
    |
    > 3 |value7 |value8 |value9 |
    >
    |
    |
    |
    |
    > ... |value..|value..|value..|
    >
    > ...
Sign In or Register to comment.