[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: How to unregister a lua_CFunction?
- From: Carsten Fuchs <CarstenFuchs@...>
- Date: Mon, 04 Dec 2006 16:57:27 +0100
I was just wondering what the proper way is to "unregister" a function that has been registered with
a call to lua_pushcfunction() or luaL_register() before.
This situation occurs whenever a "plugin DLL" registers functions to a Lua state of the main
program, and wants to withdraw them again when it is unloaded.
Is it sufficient to set the variable that holds the function to nil?
The problem is that if someone makes a copy of the variable with the function, and continues to use
the copy to call the function after the DLL has been unloaded, I expect to get a bad crash... Is
there anything I can do to prevent this kind of scenario?
Many thanks in advance, and best regards,
Ca3D - Engine http://www.Ca3D-Engine.de
Carsten Fuchs http://www.Ca3D-Engine.de/c_Carsten.php