eval
ret = eval(S[,Mode[,Lang]])
This function corresponds to the description in Far Manager Encyclopedia, with the following extensions:
1. eval
can execute either Lua or MoonScript code
Added an optional 3-rd parameter Lang
specifying the programming language
of the parameter S
in modes 1, 2 and 3. Acceptable values are "lua"
and
"moonscript"
. The default value is "lua"
.
2. Parameter S
can specify a script-file
In modes 0, 1 and 3 parameter S
can refer to a script-file, if this parameter
begins with a @
character. In this case the S
parameter must be in the
following format:
@<script-file name> [<script parameters>]
- The file name can contain environment variables, they will be expanded.
- Optional script parameters are a list of expressions separated by commas.
- The expression should use the same programming language as the script.
Example:
eval("@%MyFarScripts%\\calc.moon 'factorial', 3+5", 0, "moonscript")
3. New return codes of eval(S, 2)
0
(normal return) : is followed by any additional values that might be returned by the “evaluated” macro.-3
: if the macro selection menu was displayed and cancelled by the user.-4
: if the “evaluated” macro was interrupted by a run-time error.