11.11. Utility Functions

11.11.1. Global Functions

11.11.1.1. get_version()

Gets a string of the Wireshark version.

Returns

version string

11.11.1.2. set_plugin_info(table)

Set a Lua table with meta-data about the plugin, such as version.

The passed-in Lua table entries need to be keyed/indexed by the following:

  • "version" with a string value identifying the plugin version (required)
  • "description" with a string value describing the plugin (optional)
  • "author" with a string value of the author’s name(s) (optional)
  • "repository" with a string value of a URL to a repository (optional)

Not all of the above key entries need to be in the table. The version entry is required, however. The others are not currently used for anything, but might be in the future and thus using them might be useful. Table entries keyed by other strings are ignored, and do not cause an error.

Example:

        local my_info = {
            version = "1.0.1",
            author = "Jane Doe",
            repository = "https://github.com/octocat/Spoon-Knife"
        }

        set_plugin_info(my_info)

Since: 1.99.8

Arguments
table
The Lua table of information.

11.11.1.3. format_date(timestamp)

Formats an absolute timestamp into a human readable date.

Arguments
timestamp
A timestamp value to convert.
Returns

A string with the formated date

11.11.1.4. format_time(timestamp)

Formats a relative timestamp in a human readable form.

Arguments
timestamp
A timestamp value to convert.
Returns

A string with the formated time

11.11.1.5. report_failure(text)

Reports a failure to the user.

Arguments
text
Message text to report.

11.11.1.6. critical(…)

Will add a log entry with critical severity.

Arguments
Objects to be printed

11.11.1.7. warn(…)

Will add a log entry with warn severity.

Arguments
Objects to be printed

11.11.1.8. message(…)

Will add a log entry with message severity.

Arguments
Objects to be printed

11.11.1.9. info(…)

Will add a log entry with info severity.

Arguments
Objects to be printed

11.11.1.10. debug(…)

Will add a log entry with debug severity.

Arguments
Objects to be printed

11.11.1.11. 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.

Arguments
filename
Name of the file to be loaded.

11.11.1.12. 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.

Arguments
filename
Name of the file to be run.

11.11.1.13. register_stat_cmd_arg(argument, [action])

Register a function to handle a -z option

Arguments
argument
Argument
action (optional)
Action