I am thinking about how to create my own APIs, I plan to have a C ++ application with a script level in LUA.
For a few key points in my design, I would like to enable the user to create a function object that represents what he wants to do in the LUA, rather than send this function object from the LUA to C / C ++.
In pseudo code, in C ++ I have class T
class T {
...
int num1 = 0;
float num2 = 0.0f;
std::string str{"NONE"};
...
};
And I would like to process the instance Twith the help function objectprovided from the LUA, in this way
void applyFunc(T t,F f){
f(t);
}
The problem is that I cannot find anything in the LUA that creates a function object, such as C ++ 11 lambda or std::function, or any other object that can be thought of as a function object.
, : , ++, LUA?