[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: How to reload C functions added with "require"?
- From: Rob Shaw <rob@...>
- Date: Mon, 24 Apr 2006 12:54:47 +0200
Hi,
We've successfully been using "require" in lua 5.1 under mac osx 10.4.5
to dynamically load external C functions with bindings constructed
with tolua++.
But what I'd like to do is edit and recompile the C functions, and then
reload them, without exiting and re-entering the lua interpreter.
If you just say "require" again, nothing happens, as there is an
entry in
package.loaded[name]. I've tried setting package.loaded[name] = nil,
and this will load any new functions added, but previously registered
functions
stay the same, even if I set func = nil before the second "require".
The old function is living somewhere, and gets reattached to the name
"func".
How can I load in new versions of the old functions? It might be
nice to have
a function "reload" to go along with "require".
Thanks, sorry if I'm missing something obvious.
rob