add editor button to force reload the current module #22
Labels
Comments
|
following up on a conversation on lines, as @catfact pointed out elsewhere a work-around is to explicitly un-load the module (to the extent that you can). the basic idea can be expressed in a helper function, like this: function reload(module_name)
if (package.loaded[module_name] ~= nil) then
package.loaded[module_name] = nil
_G[module_name] = nil
end
return require(module_name)
endthat you use in your script like this: -- reload, really.
local foo = reload("foo")in the simplest cases this works well enough during development. (FWIW: i put this function in a utility library that i use while writing scripts; works great.) |
|
this is largely no longer an issue now that |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
when developing a (lua) module changes don't get picked up if the module has been already been loaded via
require.it is possible to force a module to get reloaded by setting
package.loaded.<module_name> = nilthen callingrequire '<module_name>'to facilitate module development it might be nice to have button in the editor which sends this to the repl (after a save), or by making the save button more smart...
The text was updated successfully, but these errors were encountered: