Skip to content

Supporting anonymous PHP closures / callbacks from Lua - #2

Merged
laruence merged 3 commits into
laruence:masterfrom
aurora-php:master
Oct 18, 2013
Merged

laruence merged 3 commits into
laruence:masterfrom
aurora-php:master

Conversation

@aurora

@aurora aurora commented Aug 26, 2013

Copy link
Copy Markdown
Contributor

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 ...

@laruence

Copy link
Copy Markdown
Owner

I think this idea is great. thanks very much, I will do some test then merge it. thanks :)

@aurora

aurora commented Oct 18, 2013

Copy link
Copy Markdown
Contributor Author

Thanks! Did you already have some time for testing?

laruence added a commit that referenced this pull request Oct 18, 2013
Supporting anonymous PHP closures / callbacks from Lua
@laruence
laruence merged commit 0775199 into laruence:master Oct 18, 2013
@zhang-bin zhang-bin mentioned this pull request Feb 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants