Take the tour ×  I'm implementing Lua scripting in my game using
LuaBind, and one of the things I'm not clear on is the logistics
of reloading the scripts live ingame.  Currently, using the
LuaBind C++ class luabind::object, I save references to Lua
callbacks directly in the classes that use them. Then I can use
luabind::call_function using that object in order to call the
Lua code from the C++ code.  I haven't tested this yet, but my
assumption is that if I reload the scripts, then all the
functions will be redefined, BUT the references to the OLD
functions will still exist in the form of the luabind::object
held by the C++ code. I would like to be able to swap out the
old for the new without manually having to manage this for every
script hook in the game.  How best to change this so the process
works?  My first thought is to not save a reference to the
function directly, but maybe save the function name instead, and
grab the function by name every time we want to call it. I'm
looking for better ideas!  sha