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

Debugging


If you went ahead and tried out the calculator before we entered all the scripts it needed, you most likely will have seen the script debugging in action. Hopefully, you've managed to cope with what you saw, it can be overwhelming at first. This is what it would have looked like:

Most of what you see here is the same that you'll see when you edit scripts, but if you do see the debug variation, you are actually in a paused state, which is a freeze frame of the program as it runs. In this example, the program stopped because line 46 is looking for a field named dis play. There isn't such a field, as it should be display.

The error message at the bottom of the panel makes it clear that the error has something to do with the field name and you can quickly spot the typo. Sometimes though, you may need to inspect the variables to make sure they contain the values you think they should, for example, the Variables tab will show a list of those values.

An unexpected problem is one time that you may see the debugger, but when developing a script, you are able to set breakpoints by clicking in the column just to the left of the line number you want to halt the program at.

Once the script is halted by a breakpoint, you can use the row of buttons at the top to step through the code. The content displayed as you hover the cursor above a button, is it's meaning. These buttons are:

  • Continue: This will set the script that runs again

  • Stop: This stops the script from running and switches to the editor, so that you can make changes

  • Show next statement: This will show an indicator to the left of the current line

  • Step into next statement: This is used for stepping into a different handler

  • Step over next statement: This is used to go onto the next statement in the current handler without stepping in a handler mentioned on the current line

  • Step out of current handler: This is used to skip the remaining lines in a handler that you had previously stepped into and to exit to the handler that called the current one

You will become familiar with the script editor and debugger as you go along, but that should get you started!

In this chapter, we covered just enough to make you familiar with the environment so that you can practice using some controls and to do a little script writing. There is quite a lot to LiveCode as a tool, so you may be interested to look into other topics or go into more depth than is covered here.

A good starting point would be LiveCode's own set of online tutorials, which are located at http://lessons.runrev.com/.

Type in the search box, words that describe your area of interest and you will see a list of articles on that topic.