'Attempt to index global (a nil value)' when lua is in APPDATA directory
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?