5.4 Lua primer
101
instruction can therefore be sure that the condition holds. Using
assert
frequently can considerably improve the safety and robustness of a script.
5.4.11 Comments
Anything behind a
--
token (including the
--
token) is regarded as a com-
ment and has no influence on processing. For example:
wait_click(3000) -- wait 3 secs
Multi-line comments are simply written as a multi-line string behind the
comment token:
--[[This comment
stretches across multiple lines]]
5.4.12 Script structure
Just like
uBasic
CHDK scripts,
Lua
CHDK scripts start with a
header section
defining title and script parameters. This is followed by the main body of
the script as outlined in section 5.3.10. The title and parameter section
must be provided in the form of a multi-line comment containing the title
and parameter definitions as known from
uBasic
.
--[[
rem 22-Sep-2009 by bdaum
@title Countdown
@param t ticks(sec)
@default t 10
]]
Comments within such a block can be written with the
uBasic
syntax (
rem
).
5.4.13 Standard Libraries
Unlike
uBasic, Lua
features a library concept so that new functionality can
be added to the
Lua
core without much effort. Libraries are sets of pre-
defined
Lua
functions that you can invoke in your program after you have
loaded the library. In addition, a library can immediately execute state-
ments during the loading process. It is even possible for a library to return
values to the loading script by executing a
return
command.
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 ...