Inside of test.lua
External Module, require and duplicates.
-
- Posts: 1
- Joined: Wed Feb 17, 2016 11:38 pm
External Module, require and duplicates.
I am using require in order to load a series of external lua modules. The script I have is below, which does load properly. Honestly, everything is working perfectly except for one thing. I read that using package.loaded[module] = nil would allow me to require that file again, which it does. Unfortunately, it also duplicates the contents of the file, or creates triplicates, etc.. depending on how many times I try and reload the file. I would like to be able to reload it in this manner in order to update changes to the script without having to close/open Mudlet. Is there a way to make Mudlet sort of.. forget.. that the module was previously loaded? package.loaded.test does show the entire contents of the module, and package.loaded[module] = nil does change it to nil, but the module is still loaded into memory. I hope I am explaining this okay. I have been working on it for nearly nine hours now, and I simply can't find a solution. I am also very new to Mudlet and to Lua (as in, a couple of days into it), so any help is greatly appreciated.