I'd like to embed lua to allow scripting in my C++ application. In particular, I have two structs which I'd like to pass as arguments to a given lua function. One will be read-only, the other will be read/write. Highly simplified examples of these structs follow:
struct inData
{
int x;
int y;
//many other fields follow
};
struct outData
{
int a;
double b;
//other fields follow
};
Both of these structs are created in the C++ code and will be processed there both before and after calling the lua functions. How can I pass these structs to a lua function such that the function can do things like this:
if(inData.x > 5) then outData.a = 1 end
and have the outData instance actually retain the changes after returning from the lua function?