[ANN} LiveCode List Processor - Version 1

Peter W A Wood peterwawood at gmail.com
Sat Mar 26 02:21:48 EDT 2016


I have found time to complete version 1 of my LiveCode List Processor. You can find it at https://github.com/PeterWAWood/LiveCode-ListProcessor

Many of you may be wondering why I bothered to write it when LiveCode’s built-in list processing (of delimited strings) is very good. The main reason is that LiveCode’s lists lack a memory. You can’t process a couple of items at the top of a list, go and do some thing else and then start processing the third item in the list. Well not easily. The List Processor does have a memory and you can move forwards and backwards along a list. The current position is even remembered when the list is saved.

A simple example of its use would be if you wanted to use some colours in turn. First you would make a list:

	put LP.makeList(“red:green:blue:pink:purple:brown:black:”, “:”) into myColours

When you wanted to get the next colour, you would simply get the next item in the list:

	put LP.next(myColours) into nextColour 	#nextColour would be set to “green"

You can get the next colour
	
	put LP.next(myColours) into nextColour 	#nextColour would be set to “blue"
	
You can save the list
	
	put LP.save(myColours, myURL) into tTemp 
									# tTemp would be a binary copy of the list

You can load the list from the URL and get the next colour

	put LP.load(myURL) into myColours
	put LP.next(myColours) into nextColour 	#nextColour would be set to “pink”

I suspect the number of uses of these lists with a memory is quite wide. I plan to use it to store data that I previously held in a set of cards. You can navigate through the list in a similar way to how you would navigate through cards. One small difference is that the lists don’t automatically cycle around from the last to first items as LiveCode cards do. (It would be easy to add that to the List Processor though).

When I was developing the List Processor, I wrote the tests using LiveCode MiniTest -https://github.com/PeterWAWood/LiveCode-MiniTest

The is some simple documentation on the Github page.

When writing the List Processor, I concentrated on getting it working correctly rather than speed. I’m sure that big improvements could be made and I would welcome comments and suggestions.

Regards

Peter





More information about the use-livecode mailing list