Is it possible to send lua-function to a main C++ program like this?
function a()
... -- do something
end
cpp_exported_function(a);
Or better, like this?
cpp_exported_function(function () .... end);
And how do I call it from the main program?
If it is possible - use lua table the same way. I mean exported_function(table);
?
Yes - you'd have a C++ function that accepts a luabind::object as a parameter in both those cases. Luabind defines operator[] (for indexing a table) and operator() (for calling a function) for luabind::object for exactly that reason. See the documentation here: http://www.hci.iastate.edu/~rpavlik/doxygen/luabind/docs.html#object