mlua
mlua copied to clipboard
A way to uniform functions with tables and userdata with `__call`
There are many use cases where you need to treat callable objects as function, especially when writing a library.
Maybe add a {Table, AnyUserData}::into_function, since TableExt::call's implementation is just turning the table into function and then call it?
I need to think about it. Not only into_function is needed, but apparenly a way to call functions/methods on arbitrary userdata.
Also, into_function seems too optimistic. There are other functionality available for functions, such as dump, info, coverage that may fail on callable objects.
This is done, by the AnyUserDataExt trait