PDA

View Full Version : Lookup with variable contents??



elcrcp
- 16th June 2015, 16:04
Hello,
I searched some threads releated wiht this but I couldn't see an efficient answer unfortunately, so I had to open a new thread.

What I wonder is it possible to use a variable in lookup?
I need to get variable's content as a string data to send it to display.
What I'm trying to say is that I want to do sompething like this;

for table_index=0 to X
lookup table_index,["Variable Value is:",myVar],store_data
gosub subroutine
next table_index

subroutine:
'send store_data to output

now, if MyVar contains 100, I want to send it to subroutine digit by digit as table_index increases, like; V a r i ..... 1 0 0. Not V a r i ......100

is this possible with lookup? or a backdoor to do this?

Acetronics2
- 16th June 2015, 21:28
Just open your manual @ LOOKUP2 ...

The Value list can be a mixture of 8-bit and 16-bit (and 32-bit for PBPL) numeric and string constants and variables

also may be using a pointer ...
( noooo ... not on the head !!! )

Alain

richard
- 16th June 2015, 23:08
if you have pbp3

ARRAYWRITE store_data ["Variable Value is:",dec myVar]

HenrikOlsson
- 17th June 2015, 06:05
Hi,
Although I highly recommend getting PBP3 anyway it's not strictly needed for ARRAYREAD/ARRAYWRITE as those commands were added in v2.6.

/Henrik.

elcrcp
- 17th June 2015, 09:21
Many thanks, altough I couldn't use arraywrite, lookup2 and DIG combination solved it :)
Actually I checked lookup2 before but I think I misread it's explanation, I was thinking that lookup2 is for 16bit table. I was totally wrong XD