Book Image

LiveCode Mobile Development Beginner's Guide (2nd Edition)

Book Image

LiveCode Mobile Development Beginner's Guide (2nd Edition)

Overview of this book

Table of Contents (15 chapters)
LiveCode Mobile Development Beginner's Guide Second Edition
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Loading and saving external data


In many applications, you will want to keep track of changes that a user has made. There are several ways to do this with LiveCode, including querying a URL, reading and writing to a text file, and saving data inside a stack.

Querying a URL

Quite often, web-based applications load and save data from server-side scripts. This can work with LiveCode apps too. Here's an example which shows the closing share price for Google yesterday:

put url "http://quote.yahoo.com/d/quotes.csv?s=GOOG&f=p"

At the moment of writing this book, this line was tested and 609.46 appeared in the Message Box, shown as follows:

Who knows what you'll find when you try it! In fact, while doing the second revision of this book, the number that popped up was 1172.9301. Go Google!

As with any such calls to an online service, there is a chance that it may take some time for the value to return, and in the preceding example, LiveCode would be blocked from doing anything else until the data...