User Guide

302
This handler checks whether the Command and Q keys were pressed simultaneously and, if so,
executes the subsequent statements:
on keyDown
if (the commandDown) and (the key = "q") then
cleanUp
quit
end if
end keyDown
Compare the following two constructions and the performance results. The first construction
evaluates both conditions, and so must determine the time measurement, which may take a while.
The second construction evaluates the first condition; the second condition is checked only if the
first condition is
TRUE.
spriteUnderCursor = rollOver()
if (spriteUnderCursor > 25) AND MeasureTimeSinceIStarted() then
alert "You found the hidden treasure!"
end if
The alternate, and faster, construction would be as follows:
spriteUnderCursor = rollOver()
if (spriteUnderCursor > 25) then
if MeasureTimeSinceIStarted() then
alert "You found the hidden treasure!"
end if
end if
See also
case
ignoreWhiteSpace()
Syntax
XMLparserObject.ignoreWhiteSpace(trueOrFalse)
Description
XML Command; specifies whether the parser should ignore or retain white space when generating
a Lingo list. When
ignoreWhiteSpace() is set to TRUE (the default), the parser ignores white
space.When set to
FALSE, the parser will retain white space and treat it as actual data.
If an element has separate beginning and ending tags, such as
<sample> </sample>, character
data within the element will be ignored if, and only if, it is composed of white space only. If there
is any non-white space, or if
ignoreWhiteSpace() is set to FALSE, there will be a CDATA node
with the exact text, including any white space.
Examples
These Lingo statements leave ignoreWhiteSpace() set to the default of TRUE and parse the given
XML into a list. Note that the element
<sample> has no children in the list.
XMLtext = "<sample> </sample>"
parserObj.parseString(XMLtext)
theList = parserObj.makelist()
put theList
-- ["ROOT OF XML DOCUMENT": ["!ATTRIBUTES": [:], "sample": ["!ATTRIBUTES":
[:]]]]