Comments; Script Structure; Standard Libraries - Canon Camera Hackers Manual

Camera hackers manual berthold daum
Table of Contents

Advertisement

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.
101
5.4 Lua primer

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Powershot sx10 is

Table of Contents