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

Lua script order of execution

0

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


One Answer:

1

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.

This answer is marked "community wiki".

answered 29 Apr '14, 11:46

needaclone's gravatar image

needaclone
11114
accept rate: 0%