lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


I was wondering how to reload a module if a code change was made in the module itself. If I am fixing a bug and testing my application I can "Reload" [1] my script in my application. This worked great until I "modularized" the script. I was bebugging the changes in my script and noticed I letf some unneeded code in my module functions, so I removed it and "Reloaded" my main script, that includes the modules, using require(). I did not see the change I made in the module until I shut my application down and restarted it. What is the reason for this? Is there a better way for me to "Reload" my script so it picks up my changes in a module?

[1] Code that Reloads:
// The lua_State L is just reused and not deleted
luaL_loadfile( L, filename.c_str() );
lua_pcall( L, 0, 0, 0 );
RJP Computing