-
Notifications
You must be signed in to change notification settings - Fork 1
UsefulCodes
Wojciech Baczyński edited this page Jan 23, 2017
·
6 revisions
file.remove("init.lua")
node.compile("info.lua")
require("basic") == dofile("basic.lc")
package.loaded['filename']=nil | only with require()
collectgarbage()
local M, module = {}, ...
...
function M.init(csocket)
package.loaded[module]=nil
...
end
...
return M
Using: require("connector").init(c)
local module = _ -- this is a situation where using an upvalue is essential!
return function (csocket)
package.loaded[module]=nil
module = nil
...
end
Using: require("connector")(c)
Load some functions and at the end call init() !!! Otherwise our volatile modules won't work.
Additionally there is a little improvement while assigning tmp to some function and then reassign it to nil.
tmp = require("basic_compile").compileAllFiles()
tmp = nil
require("basic_compile").init()
collectgarbage()
Command to LuaSrcDiet:
./LuaSrcDiet.lua --maximum --details --opt-srcequiv ../../Modules/api/init.lua -o ../../Modules/api/init_.lua