Wireshark LUA use field from previous/lower dissector
I have written an custom LUA dissector for ERSPAN. But to apply different header based on the ERSPAN Type indicated by gre.proto field in GRE header, I would like to use the value of gre.proto field in my dissector.
I have already searched and saw methods using post dissector but I am doing something wrong and it is not working for me.
So I would like to have something like this within my custom dissector:
if greprotocolversion == 0x22eb then
...
...
elseif gregreprotocolversion == 0x88be then
..
..
end
What would be the most simple method to accomplish this? Thank you.