Module utils.loader Code loading/unloading utils

Type utils.loader

utils.loader.loadBuffer(buffer, name, destroy) Compiles a buffer (ie a list of strings) into an executable function.
utils.loader.unload(name) Unloads a module by removing references to it.

Type utils.loader

Field(s)

utils.loader.loadBuffer(buffer, name, destroy)

Compiles a buffer (ie a list of strings) into an executable function.
As opposed to loadstring it does not require allocating a single string for the whole source, thereby saving on memory load. Moreover, if the last argument is true, the buffer is emptied as it is read, thus saving even more memory (but destroying the buffer).

Parameters

Return value

function resulting of the buffer compilation

utils.loader.unload(name)

Unloads a module by removing references to it.

Here is the sequence of operations made by this function:

  1. Call package.loaded[name].__unload() if existing
  2. Clear: package.loaded[name]
  3. Clear: _G[name]

Parameter