Reputation: 147
I've created a table and assigned a method with lua_pushcfunction
named mytable:myfunction()
. In a different (callback) context it's necessarily that myfunction
will be overriden inside the Lua script. For some reasons, if i call myfunction
from the C host, I need to know, if myfunction
is still the c function or was replaced by the script.
Is there a way to test (from C), if the C method is still attached or is replaced by some Lua code ?
Upvotes: 6
Views: 620
Reputation: 20838
Another possibility is to use lua_tocfunction
. This allows you to also check if the C function you got back is the one you expect.
Upvotes: 0