I thought it would be cool to have the possibility to provide a PHP callback to a Lua function or return it from a call from Lua to PHP, without having to register it as callback first. Please have a look at the test i added (013.phpt) for details. I must admit, that i do not have much experience with php core development / extension development, so my code may contain serious issues. I more or less copied the stuff from "registerCallback" function.
I am not sure if this is the right way to do it, anyway, because function names as strings is not supported with this solution (how to determine if the user intended to provide a function name with the string value provided as return value or function parameter?). I hade to move the "php_lua_call_callback" method in the source file to prevent a compilation issue on osx (php_lua_call_callback defined after php_lua_send_zval_to_lua), just in case you wonder ...
I thought it would be cool to have the possibility to provide a PHP callback to a Lua function or return it from a call from Lua to PHP, without having to register it as callback first. Please have a look at the test i added (013.phpt) for details. I must admit, that i do not have much experience with php core development / extension development, so my code may contain serious issues. I more or less copied the stuff from "registerCallback" function.
I am not sure if this is the right way to do it, anyway, because function names as strings is not supported with this solution (how to determine if the user intended to provide a function name with the string value provided as return value or function parameter?). I hade to move the "php_lua_call_callback" method in the source file to prevent a compilation issue on osx (php_lua_call_callback defined after php_lua_send_zval_to_lua), just in case you wonder ...