Canon Camera Hackers Manual page 114

Camera hackers manual berthold daum
Table of Contents

Advertisement

ret,msg,no = file:write(value1,...)
writes the values passed in the parameters to the specified file. Only
numeric or string values are allowed as parameters. In case of an error, ret
is nil, and an error message is given in msg, an error code in no.
Operating system functions
Only some of the standard Lua OS functions are supported in the CHDK.
r, msg = os.remove(filename)
deletes a file or directory with the specified name. If it succeeds, true is
returned. If it fails, nil is returned, followed by an error message. The func-
tion will fail on an attempt to delete a directory that is not empty..
r,msg = os.rename(oldname,newname)
renames the file or directory specified in oldname to the name given in
newname. If it succeeds, true is returned. If it fails, nil is returned, followed
by an error message.
Caution! Attempting to rename a nonempty directory may result in file
system corruption! Attempting to move a file to another directory by re-
naming it can lead to unpredictable results. The rename() function may
produce unpredictable results if the target name already exists.
t = os.time(table)
returns the time specified in table as a single number (number of seconds
since January 1, 1970). The table has the following keywords: "year",
"month", "day", "hour", "min", "sec", "dst", "wday". "dst" represents a Bool-
ean value that is true for daylight savings time; "wday" represents the day
of the week (Sunday = 1).
If the parameter table is missing, the function delivers the current date
and time as a number:
s = os.date(format, time)
The date() function works the other way round. The format string speci-
fies how a numeric date value will be converted into a string. If the second
parameter is missing, the current date is used. The format string can con-
tain short control sequences ('%' followed by a letter) that will be replaced
by year, month, day, etc. The following control sequences are possible:
105
5.4 Lua primer

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Powershot sx10 is

Table of Contents