Equivalent in LiveCode to Director Lingo lists

Want to move your code and projects to LiveCode but don't know where to start?

Moderators: FourthWorld, heatherlaine, Klaus, robinmiller

Post Reply
bd525
Posts: 80
Joined: Sun Aug 31, 2014 12:43 am

Equivalent in LiveCode to Director Lingo lists

Post by bd525 » Tue Sep 23, 2014 9:49 pm

I'm converting a project from Director to Livecode and I have a lot of code that uses Lingo lists. There are linear lists [1,2,3] or ["one","two","three"] and property lists [1:"one",2:"two",3:"three"]. Am I correct that the LiveCode array is the proper equivalent? If so, is there a quicker and easier way to convert than one value and key at a time?

For example, I can do the following:
for this Lingo code:
put [4,4,4,4,4,4] into someVariable
in LiveCode:
put "4,4,4,4,4,4" into temp
repeat with i = 1 to 6
put value(item i of temp) into someVariable
end repeat

This works but is a lot of tedious work for my rather large project.

I hope this makes sense. Any assistance is much appreciated!

Klaus
Posts: 13793
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Equivalent in LiveCode to Director Lingo lists

Post by Klaus » Wed Sep 24, 2014 11:57 am

Hi bd525,

1. welcome to the forum! :D

2. For "property lists" you can use the SPLIT command to turn them into an Array:
...
put "1:one,2:two,3:three" into tV
split tV by "," and ":"
...

3. For linear lists like "4,4,4,4,4,4" you can also use the SPLIT command:
...
put "4,4,4,4,4,4,4" into tV
split tV by ","
...

Best

Klaus

bd525
Posts: 80
Joined: Sun Aug 31, 2014 12:43 am

Re: Equivalent in LiveCode to Director Lingo lists

Post by bd525 » Wed Sep 24, 2014 1:03 pm

Nice! Thanks.

Bruce

jiml
Posts: 336
Joined: Sat Dec 09, 2006 1:27 am
Location: Los Angeles

Re: Equivalent in LiveCode to Director Lingo lists

Post by jiml » Wed Sep 24, 2014 5:13 pm

Bruce,

Welcome.

It's been a long time since I used Director, so I may be mis-remembering.
But yes, LiveCode has rough equivalents to Lingo's Linear and Property lists.

One difference. When you stick values into a Director property list, they stay in the order in which you added them.
But with LiveCode the order of the keys is not always the same as the order in which you entered them.
In other words there isn't an equivalent getPropAt() function for property arrays (although if you manually number a linear list, you can get a something like it).

And there's no accessing by dot syntax references.

Jim Lambert

bd525
Posts: 80
Joined: Sun Aug 31, 2014 12:43 am

Re: Equivalent in LiveCode to Director Lingo lists

Post by bd525 » Thu Sep 25, 2014 2:25 pm

Thanks, jiml. It appears that I can make LiveCode work for me without too much hassle.

Post Reply

Return to “Converting to LiveCode”