I'm trying to embed Lua in my C program to extend the program's debugability. Lua tutorials describe how to use Lua as a config file. In the config file, Lua variables, or even functions can be defined, so a C program can load the file and use the Lua functions to extend some of its ability.
However, if the config file is modified after it's loaded, the new content won't take effect. My question is how to support hot reload without restarting my C program?
Edit:
A more basic question: since the Lua functions/variables has been loaded, can they be overwritten? for example, the C program has been calling function f1(x) return x*x end
in a loop, then the function is changed to be function f1(x) return x*x*x end
in the config file. If we can hot reload it in some way, will the C program use the new definition?