file(string) Full path and file name of script. The file extension is optional and ignored (see
modeparam to control which extension will be used). However, if an extension is specified, it should be ".lua" (or ".luac"), otherwise it is treated as part of the file name and the .lua/.luac will be appended to that.
mode(string) (optional) Controls whether to force loading the text (.lua) or pre-compiled binary (.luac) version of the script. By default OTx will load the newest version and compile a new binary if necessary (overwriting any existing .luac version of the same script, and stripping some debug info like line numbers). You can use
modeto control the loading behavior more specifically. Possible values are:
T(default on simulator) prefer text but load binary if that is the only version available.
bt(default on radio) either binary or text, whichever is newer (binary preferred when timestamps are equal).
xto avoid automatic compilation of source file to .luac version.
cto force compilation of source file to .luac version (even if existing version is newer than source file).
dto keep extra debug info in the compiled binary.
env(integer) See documentation for Lua function loadfile().
functionThe loaded script, or
nilif there was an error (e.g. file not found or syntax error).
stringError message(s), if any. Blank if no error occurred.
modeas "b" or "t" and that specific version of the file does not exist (eg. no .luac file when "b" is used). Also note that
modeis NOT passed on to Lua's loader function, so unlike with loadfile() the actual file content is not checked (as if no mode or "bt" were passed to loadfile()).