Runs a file in an environment, in which a polyfill for the standard require function exists.
Essentially allows writing widgets over multiple files.
|program (name[, context])||Runs the specified file inside a new clean environment with access to require.|
- 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.
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
nameparameter to program and require can point to a directory, ending in "
/", which is equivalent to point to the
main.luafile inside that directory.
Relative path from
LuaUI/Widgetsto 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)
rawTable view of the environment in which the files ran
- name string Relative path from