1
votes

Say I have a C function that returns a pointer to const and I want to expose this function to lua. How do I do that? I cannot use lua_pushlightuserdata to push the return value of that function onto the stack because lua_pushlightuserdata expects an argument of type void *, not void const *.

1

1 Answers

3
votes

If you want to use light userdata, you have no other option then to cast it to a void*.

The other option is to use full userdata. That adds complexity but also gives you more control and the ability the check the type.