Following up on the question:
i've checked your branch a little bit - can you explain how this swig stuff will work for us? what is needed in order to generate the bindings and stuff like that?
As it turns out, the default usage of SWIG is to provide a lua script access to a C program. This is not what I had in mind. Like the lua integration for the AI, I wanted to call from the C program into a specific lua function. More to the point: I want to call a lua function in a script that, using C functions, creates uiNode_t nodes and then returns this structure back to the C program. Technically this is called embedding and the hard part is because the returned value isn't a primitive value.
SWIG has some utility functions, however they where located in the generated .cpp file. That is, until I finally figured out how to get to these functions without actually copying the signature into my own header. Luckily the guys building SWIG have added an option to expose the utility functions using a generated header file. To do this, call once:
swig -c++ -lua -external-runtime swig_lua_runtime.h
The generated header file can now be used to convert values, wrapped by SWIG and passed on into lua, back to the original C values. I've attached a zip-file with a test project showing how this is done. The line above is attached as a prebuild step.
I'm posting the description to make sure it is documented for the future, since it took me really some time to figure this out.
xray