[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: How to reload C functions added with "require"?
- From: Fabian Peña <fapenia@...>
- Date: Mon, 24 Apr 2006 11:01:10 -0300
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
I think that you must add "C" code for unload dynamic library module (
very necesary under windows to unlock the file ) and invoque a require
or directly call to loadlib function again.
Rob Shaw wrote:
> 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
>
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFETNomWmd5q6r1OEoRAqEnAKCRfRpuc8OztpeU+TPP2GKeRvShdgCeII42
NMcwAgzgPUetlOJstGPKafM=
=KaIo
-----END PGP SIGNATURE-----