First time here? Check out the FAQ!
THIS IS A TEST INSTANCE. Feel free to ask and answer questions, but take care to avoid triggering too many notifications.
0

'Attempt to index global (a nil value)' when lua is in APPDATA directory

  • retag add tags

Hi,

I am running Wireshark 4.0.2 on Windows 11.

I have 3 lua files that constitute our custom dissector. The top level lua file is general.lua which creates a protocol object:

xran_protocol = Proto("xran", "<snip>")

xran_protocol.prefs.c_plane_debug_level = Pref.enum("C-plane debug", 0, "C-plane debug printing level", debug_pref_enum, false)

A lower level lua file accesses that object:

debug_level = xran_protocol.prefs.c_plane_debug_level <--- A

If my lua files are in the global plugin folder:

"C:\Program Files\Wireshark\plugins\4.0"

it works fine. But if I move the lua files to the personal plugin folder:

%APPDATA%\Wireshark\plugins

line A above gives error:

Lua Error: ...rs\<name>\AppData\Roaming\Wireshark\plugins\cplane.lua:333: attempt to index global 'xran_protocol' (a nil value)

Please can you suggest why it works in the global folder but not in the personal folder?

DavidA_2018's avatar
15
DavidA_2018
asked 2023-01-18 14:31:46 +0000
edit flag offensive 0 remove flag close merge delete

Comments

add a comment see more comments

1 Answer

0
Chuckc's avatar
3k
Chuckc
answered 2023-01-18 14:49:07 +0000, updated 2023-01-18 14:50:21 +0000
edit flag offensive 0 remove flag delete link

Comments

Thank you.

DavidA_2018's avatar DavidA_2018 (2023-01-18 14:58:20 +0000) edit
add a comment see more comments

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss.

Add Answer