5.4 Lua primer
95
The CHDK functions
cls()
and
print_screen()
work exactly the same
as the equivalent commands in
uBasic.
There is one exception:
print_screen(false)
can be used to disable output to a log file.
5.4.6 Blocks
Blocks are statement sequences that are enclosed by
do ... end
. Their
main purpose is to allow the definition of local variables that are only valid
within the block. Blocks may be nested.
5.4.7
Conditional
clauses
Similar to
uBasic,
conditional clauses are built with the
if ... then ...
else ... end
construct. The difference is that the construct is not closed
by a specific
endif
token but by the more generic
end
token. For example:
if a < 0 then
b = 3
else
b = 4
end
The
else
clause may be omitted, but in contrast to
uBasic,
it is not possible
to omit the
end
token even for single line constructs:
if n < 0 then n = 0 end
Nested
if
statements can be simplified with the
elseif
token. Instead of:
if a < 0 then
b = -1
else
if a > 0 then
b = 1
else
b = 0
end
end
Summary of Contents for Camera
Page 1: ......
Page 2: ...The Canon Camera Hackers Manual ...
Page 3: ......
Page 4: ...Berthold Daum The Canon Camera Hackers Manual Teach Your Camera New Tricks ...
Page 19: ...10 CH APTER 2 Cameras and Operating Systems ...
Page 25: ...16 CH APTER 3 ...
Page 85: ...76 CH APTER 4 Teach Your Camera New Tricks ...
Page 213: ...204 CH APTER 6 ...
Page 253: ...244 AP PENDIX ...