-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating
Mastering the Nmap Scripting Engine
By :
File manipulation in Lua is done on either implicit or explicit file descriptors. We will focus on using explicit file descriptors to perform most of the operations.
If we work with implicit file descriptors by default, Lua will use stdin and stdout respectively. Alternatively, we can set the output and input descriptors with io.output and io.input, respectively.
File modes supported in Lua are the following:
|
File mode |
Description |
|---|---|
|
|
This is read mode. |
|
|
This is write mode. |
|
|
This is append mode. |
|
|
This is update mode. It preserves existing data. |
|
|
This is update mode. It deletes any existing data. |
|
|
This is append update mode. It preserves existing data and only allows appending at the end of the file. |
The io.open function returns a file descriptor if successful:
file = io.open (filename [, mode])
If it fails, it will return nil and the corresponding error message (like most Lua functions).
To read a file using an explicit file...
Change the font size
Change margin width
Change background colour