EasyManua.ls Logo

Canon Camera - Page 163

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...
154 CHAPTER 5 Scripting
if e > a then
t = t + tonumber(
string.sub(s, a, e - 1))
end
a = e + 1
end
return t * 1000
end
function parseDisp(token)
t = string.upper(token)
d = string.find("IND",t)
if d then return d - 1 end
end
The function parse() parses a whole line. It first checks to see whether a
line is a comment line. If so, it prints the comment and returns nil. Other-
wise, it sets the default values for the resulting parameters and appends a
white space character to the end of the line to make parsing easier. Then
the function searches for white space. If a white space character is found,
the text before the white space is analyzed with one of the functions de-
fined above. In case of success, the read pointer (a) is incremented, so that
parsing continues behind the white space character.
function parse(line)
if string.find(line, "%-%-")
== 1 then
print(string.sub(
line, 3, #line))
return nil
end
line = line.." "
local n,focus,disp,met,i1,i2,a =
1,nil, nil, 0, 0, 0, 1
local e = string.find(line, " ")
if (e - a) <= 1 then
focus = parseFocus(
string.sub(line, a, e - 1))
if focus then
a = e + 1
e = string.find(line, " ", a)
end
end

Table of Contents

Related product manuals