11.13. Utility Functions
Prev | Chapter 11. Lua Support in Wireshark | Next

## 11.13. Utility Functions

### 11.13.1. Dir

A Directory

#### 11.13.1.1. Dir.open(pathname, [extension])

Usage: for filename in Dir.open(path) do ... end

##### 11.13.1.1.1. Arguments

pathname

  The pathname of the directory

extension (optional)

  If given, only file with this extension will be returned

##### 11.13.1.1.2. Returns

the Dir object

#### 11.13.1.2. dir:__call()

At every invocation will return one file (nil when done)

#### 11.13.1.3. dir:close()

Closes the directory

### 11.13.2. Non Method Functions

#### 11.13.2.1. get_version()

Get Wireshark version

##### 11.13.2.1.1. Returns

version string

#### 11.13.2.2. format_date(timestamp)

Formats an absolute timestamp into a human readable date

##### 11.13.2.2.1. Arguments

timestamp

  A timestamp value to convert.

##### 11.13.2.2.2. Returns

A string with the formated date

#### 11.13.2.3. format_time(timestamp)

Formats a relative timestamp in a human readable form

##### 11.13.2.3.1. Arguments

timestamp

  A timestamp value to convert

##### 11.13.2.3.2. Returns

A string with the formated time

#### 11.13.2.4. report_failure(text)

Reports a failure to the user

##### 11.13.2.4.1. Arguments

text

  Message

#### 11.13.2.5. critical(...)

Will add a log entry with critical severity

##### 11.13.2.5.1. Arguments

...

  objects to be printed

#### 11.13.2.6. warn(...)

Will add a log entry with warn severity

##### 11.13.2.6.1. Arguments

...

  objects to be printed

#### 11.13.2.7. message(...)

Will add a log entry with message severity

##### 11.13.2.7.1. Arguments

...

  objects to be printed

#### 11.13.2.8. info(...)

Will add a log entry with info severity

##### 11.13.2.8.1. Arguments

...

  objects to be printed

#### 11.13.2.9. debug(...)

Will add a log entry with debug severity

##### 11.13.2.9.1. Arguments

...

  objects to be printed

#### 11.13.2.10. loadfile(filename)

Lua's loadfile() has been modified so that if a file does not exist in the current directory it will look for it in wireshark's user and system directories

##### 11.13.2.10.1. Arguments

filename

  Name of the file to be loaded

#### 11.13.2.11. dofile(filename)

Lua's dofile() has been modified so that if a file does not exist in the current directory it will look for it in wireshark's user and system directories

##### 11.13.2.11.1. Arguments

filename

  Name of the file to be run

#### 11.13.2.12. persconffile_path([filename])

##### 11.13.2.12.1. Arguments

filename (optional)

  A filename

##### 11.13.2.12.2. Returns

The full pathname for a file in the personal configuration directory

#### 11.13.2.13. datafile_path([filename])

##### 11.13.2.13.1. Arguments

filename (optional)

  A filename

##### 11.13.2.13.2. Returns

The full pathname for a file in wireshark's configuration directory

#### 11.13.2.14. register_stat_cmd_arg(argument, [action])

Register a function to handle a -z option

##### 11.13.2.14.1. Arguments

argument

  Argument

action (optional)

  Action

Prev | Up | Next
11.12. Functions for handling packet data | Home | Appendix A. Files and Folders