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

many locals in lua file



I'm writing a tool that transfers some XML file into a LUA file. The XML file contains above 100 messages.

I have to have as minimum following 2 statements for each message:

local p_multi = Proto("multi", "MultiProto");
local f=p_multi.fields

meaning that I have at least 200 'local' records which is limited by LUA. I've tried to use it as follows, but getting an error:

local locals={}
locals.p_multi = Proto("multi", "MultiProto");

I've also tried to remove the local statement, but in Wireshark I've received an empty message content (i.e all the fields were with null value)

p_multi = Proto("multi", "MultiProto");

Any suggestion how to solve it?

Thank you :)

asked 13 Sep '17, 21:55

BMWE's gravatar image

accept rate: 100%

edited 13 Sep '17, 22:00

I've found how can I reduce to a single local instead of two. but this still can be problematic as number of messages can be above 200 (different small messages send on the network).

(13 Sep '17, 22:12) BMWE

One Answer:


Replacing locals.f=p_multi.fields with locals.f=locals.p_multi.fields and doing same in all relevant places solved the issue

answered 18 Sep '17, 01:48

BMWE's gravatar image

accept rate: 100%

Hello, I am also generating lua dissectors. Do you mind me asking what these are for?

Maybe we could share some knowledge. Here are a few examples:


(03 Oct '17, 13:13) william


Having a glimpse on your work and it seems good. I'll have some additional look later.

(04 Oct '17, 07:08) BMWE