Canon Camera Hackers Manual page 199

Camera hackers manual berthold daum
Table of Contents

Advertisement

190
C H A P T E R 5
Scripting
local ret = false
while true do
local s1 = f1:read (256)
local s2 = f2:read (256)
if not (s1 or s2) then
break
elseif s1 ~= s2 then
ret = true
break
end
end
f1:close()
f2:close()
return ret
end
Now all preparations are done, and we can start to read the INI file. The
configuration counter and the name of the current configuration are set to
default values, and, if the INI file exists, it is read line-by-line using the
io.lines() function. For each line, we run through the functions in table
parser_func and check to see whether a function applies. By now we
should have the current configuration count in the variable ccount and the
current configuration name in the variable config_name:
ccount = 0
config_name = ""
-- ini file parsing
if os.stat(ininame) then
for line in io.lines(ininame) do
for _,f in pairs(
if f(line) then break end
end
end
end
Next, we allow the user to select the configuration to switch to. To do this,
we fetch the list of files contained in the folder CHDK/CONFIGS/. If this folder
does not exist, we just use the empty list.
If the list of files is not empty, we sort the files in alphabetic order to
determine the index of the current configuration, since we want to display
this configuration to the user. Then, in the following while loop, the user
can use the
LEFT
can be used to select a configuration.
parser_funcs) do
and
RIGHT
buttons for scrolling in the list. The
SET
button

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Powershot sx10 is

Table of Contents