Module program
Runs a file in an environment, in which a polyfill for the standard require function exists.
Essentially allows writing widgets over multiple files.
Functions
program (name[, context]) | Runs the specified file inside a new clean environment with access to require. |
Functions
- program (name[, context])
-
Runs the specified file inside a new clean environment with access to require.
The require can be given a string corresponding to a relative path to the location of the file that uses it, without extension, and the specified file gets evaluated as well. If the same file would be evaluated two times, it is evaluated only the first time and the same result is returned the next time.
It is also capable of resolving cyclic references by utilizing Surrogates.
Remarks:
-
Even when an environment is given, the files run in a clean environment, that just allows them to access the given one. Names given as
name
parameter to program and require can point to a directory, ending in "/
", which is equivalent to point to themain.lua
file inside that directory.Parameters:
- name
string
Relative path from
LuaUI/Widgets
to the file that is the root of the "program" - context tab Optional parameter; the environment, that should be available within the files, it uses widget otherwise (optional)
Returns:
-
tab
rawTable view of the environment in which the files ran
- name
string
Relative path from