Huge thanks to our Platinum Members Endace and LiveAction,
and our Silver Member Veeam, for supporting the Wireshark Foundation and project.

Wireshark-users: Re: [Wireshark-users] Pass command line arguments to a LUA script?

From: Tony Trinh <tony19@xxxxxxxxx>
Date: Mon, 25 Jul 2011 21:09:48 -0400
AFAIK, you cannot directly pass args from the command line to Wireshark Lua, but an easy alternative would be to use environment variables. Set an environment variable and query it from your script, using os.getenv.

Here's an example from OSX:

$ echo "print('TESTVAR', os.getenv('TESTVAR'))" > test.lua
$ TESTVAR="hello world" tshark -v -Xlua_script:test.lua 
TESTVAR hello world

TShark 1.7.0 (SVN Rev 38064 from /trunk)

Copyright 1998-2011 Gerald Combs <gerald@xxxxxxxxxxxxx> and contributors.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Compiled (64-bit) with GLib 2.28.8, with libpcap 1.1.1, with libz 1.2.5, without
POSIX capabilities, without threads support, without libpcre, without SMI,
without c-ares, without ADNS, with Lua 5.1, without Python, without GnuTLS,
without Gcrypt, with MIT Kerberos, without GeoIP.

Running on Mac OS 10.7.0 (Darwin 11.0.0), with locale en_US.UTF-8, with libpcap
version 1.1.1, with libz 1.2.5.

Built using llvm-gcc 4.2.1 (Based on Apple Inc. build 5658) (LLVM build
2335.15.00).