Let's say I have the following Lua code.
function touched(x, y)
end
function moved(x, y)
end
function released(x, y)
end
These functions are called from C++ with lua_pcall
so I can also listen to these events in C++.
But I wonder if it's possible to add a listener that listens to specific Lua function based on the name of that function in C++.
For example, it can be something like the following in C++
lua_addlistener(L, "touched", this, &MyClass::touchedFromLua);
And then it can listen to the touched
function in Lua code. (if the function "touched" exists)
Is this possible to do something similar?