This is our old Q&A Site. Please post any new questions and answers at ask.wireshark.org.

What controls the order in which Lua scripts get executed?

Scripts in the global configuration plugins directory get executed first.

Scripts in the local (user) configuration plugins directory get executed next.

Scripts specified from the command line (e.g. with -X lua_script:somescript.lua) get executed last. When multiple scripts are passed from the command line using -X, they are executed in the order they appear on the command line.

What controls the order of execution of scripts when multiple scripts exist in, say, the local plugins directory? With the little experimentation I've done (in Linux only) it appears to be reverse alphabetical by script file name. However, I didn't experiment to see if there is another factor (e.g. date created or modified.) And I haven't experimented on a windows platform yet. I have not searched the source code yet...

This question is marked "community wiki".

asked 29 Apr '14, 07:39

needaclone's gravatar image

needaclone
11114
accept rate: 0%

edited 29 Apr '14, 11:39


The answer seems to be that there is no guaranteed order per se.

Under the hood, Wireshark uses the glib function g_dir_read_name() to run through all the files in a given directory, subsequently loading all the .lua scripts. Online documentation for g_dir_read_name() at developer.gnome.org says "The order of entries returned from this function is not defined, and may vary by file system or other operating-system dependent factors."

So, there's no guarantee the the order of execution will be the same across OS or filesystem types or versions.

permanent link
This answer is marked "community wiki".

answered 29 Apr '14, 11:46

needaclone's gravatar image

needaclone
11114
accept rate: 0%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×431
×31
×10
×1

question asked: 29 Apr '14, 07:39

question was seen: 2,007 times

last updated: 29 Apr '14, 11:46

p​o​w​e​r​e​d by O​S​Q​A