And another thing...

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
RossG
Posts: 247
Joined: Thu Jan 08, 2015 7:38 am

And another thing...

Post by RossG » Tue Nov 15, 2016 6:03 am

I have some code which uses a loop

repeat with x = 10 to 50

after each loop I want numbers put into
a variable which includes x e.g. when x = 10

put Ones into "Ones" & x --- want it to go into variable Ones10

but LC gives me a "bad destination" for all the combinations and
variations I've tried. Of course the combination/variation I haven't
tried yet is the one that works!

Why does the ratio of works:doesn't work always have to be 1:100?

Help appreciated.
Is age an excuse? Eighty-four and counting.
Programming powered by coffee.

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10323
Joined: Wed May 06, 2009 2:28 pm

Re: And another thing...

Post by dunbarx » Tue Nov 15, 2016 6:12 am

Hi.

In order to create and load variables on the fly, I usually do something like this. Make a button. In its script:

Code: Select all

 on mouseUp
   repeat with y = 1 to 10
      do "put y * 2 into onTheFlyVar" & y
      breakPoint
   end repeat
end mouseUp
This creates ten "named" variables, and loads them with values of twice the index. Just an example.

Write back with your own offerings.

Craig

EDIT.

Add breakpoint to see development of each new variable.

Post Reply