easy C function wrapper #225
morgoth990
started this conversation in
Show and tell
Replies: 1 comment
-
I took a stab at implementing something similar but using C++17 variadic templates: https://gist.github.com/zeux/6779d59c9e3edf640ad7d0b586710ea0 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Don't know if anyone can find this useful.
I have implemented a macro/template to automatically generate the
int (*lua_CFunction)(lua_State* L)
wrapper.It pops arguments, calls the C function and push the return value (if not void) into the lua stack.
The macro allow to wrap functions like this:
Currently there is a limit of 10 arguments max but can easly increased.
Implementation:
lua_CFunctionWrapper.h
Beta Was this translation helpful? Give feedback.
All reactions