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

I've used Matlab (this is the easiest language for me) to generate a Lua dissector from an XML file describing a protocol.

The issue right now, is that it is generating too many local (global) variables and I'm getting the

`too many local variables (limit is 200) in main function near '='`


Many of the variables (~150) are due to some enumeration.

Any suggestion how to solve it?

asked 10 Aug '17, 01:27

BMWE's gravatar image

accept rate: 100%

edited 10 Aug '17, 01:39

sindy's gravatar image


@BMWE, I've converted your post to a new Question as this way it better fits this site's purpose.

(10 Aug '17, 01:39) sindy

To the subject, what means "some enumeration"? If your protocol has 150 distinct fields, there is no surprise that 150 variables get created. If that is not the case, please provide some more details.

(10 Aug '17, 01:40) sindy

I realize this is an old question on a now-obsolete Q&A site, but in case anyone finds themselves in this situation, one solution is to group variables together into a Lua table.

For example, instead of:

local variableA = 1
local variableB = 2
local variableZ = 26

use something like:

local variables = {
    A = 1,
    B = 2,
    Z = 26
permanent link

answered 31 Jul '18, 09:15

cmaynard's gravatar image

cmaynard ♦♦
accept rate: 20%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 10 Aug '17, 01:27

question was seen: 2,351 times

last updated: 31 Jul '18, 09:15

p​o​w​e​r​e​d by O​S​Q​A