EasyManua.ls Logo

Canon Camera - Loops

Canon Camera
257 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
96 CHAPTER 5 Scripting
it is possible to write:
if a < 0 then
b = -1
elseif a > 0 then
b = 1
else
b = 0
end
which is easier to read and to understand. Lua does not feature a select
statement (section 5.3.5), but a sequence of elseif clauses can be used for
the same purpose.
Relational operators allowed in Lua are:
== (equals) (uBasic: =)
> (greater than)
< (less than)
~= (not equal) (uBasic: <>)
<= (less than or equal)
>= (greater than or equal)
It is also possible to connect several conditions with the operators and, or,
and not. Parentheses may be used to indicate which operators are executed
first:
if (a = 1 or a = 2) and b < 0 then ...
5.4.8 Loops
Similar to uBasic, the for-loop is used for incrementing a counter from a
start value to an end value and for executing the instructions within the
loop for each counter value. For example:
for i = 1,n do
sleep(10000)
shoot()
end
takes n shots every 10 seconds.
By default, the increment value of the for construct is 1. By using a third
value in the for clause, however, it is possible to specify a different incre-
ment value:

Table of Contents

Related product manuals