I would like to add protofields to my dissector so it is easier to filter on. However, the data for the dissector is contained in multiple lua files (as tables). I have the following code:
But this is not working. I've tried concatenating the i variable in a number of ways (t..i, t[i], etc) but it is not working. Is it possible to create dynamic variable names in lua like this? asked 24 Nov '14, 07:12 hls edited 23 Dec '14, 01:20 Hadriel |
2 Answers:
I was able to get my code working, doing a combination of trial and error, as well as global tables.
I was then able to use that global variable to add a protofield string
and finally, use that table to add to the fields table.
Not the prettiest code, but it's currently working answered 23 Dec '14, 09:35 hls |
What exact error message(s) are you getting? Lua does indeed support variables for table indexes/keys, and the correct syntax would be:
...but it's not going to work unless you did other stuff you're not showing in your question's Lua snippet. For example, " You probably want to do this instead:
answered 23 Dec '14, 01:20 Hadriel |