Call script function
Executes Lua code from a string or file and calls the specified function
- Parameters
- Advanced call ?
Function CallScriptFunction(Val Lua, Val Script, Val FunctionName, Val Parameters = Undefined, Val Packages = Undefined, Val Variables = Undefined) Export
| Parameter | CLI option | Type | Required | Description |
|---|---|---|---|---|
| Lua | --lua | Arbitrary | ✔ | Lua AddIn or Lua version to run |
| Script | --script | String | ✔ | Lua code or file path |
| FunctionName | --func | String | ✔ | Function name or path in module.func format |
| Parameters | --params | Map Of KeyAndValue | ✖ | Function parameters, if necessary |
| Packages | --packages | Map Of KeyAndValue | ✖ | Packages: key > name, value > code or file path |
| Variables | --globals | Map Of KeyAndValue | ✖ | Module global variables, if necessary |
Returns
Arbitrary - Calling result
| Parameter | Description |
|---|---|
| addin_mode | Manual selection of external component connection mode (for 1C): Isolated, NotIsolated |
| dontwait | Creates a background job and returns its data (for 1C and OneScript only) |
tip
Similarly to separate calls of ExecuteCodeFromString, AttachPackageFromString, SetGlobalVariable, and CallFunction
1C:Enterprise/OneScript code example
Parameters = New Array;
Parameters.Add(6);
Parameters.Add(7);
Result = OPI_Lua.CallScriptFunction("Lua54"
, "function mul(a, b) return a * b end"
, "mul"
, Parameters);
- Bash
- CMD/Bat
# JSON data can also be passed as a path to a .json file
oint lua CallScriptFunction \
--lua "Lua54" \
--script "function mul(a, b) return a * b + bonus end" \
--func "mul" \
--params "['6','7']" \
--globals "{'bonus':'2'}"
:: JSON data can also be passed as a path to a .json file
oint lua CallScriptFunction ^
--lua "Lua54" ^
--script "function mul(a, b) return a * b + bonus end" ^
--func "mul" ^
--params "['6','7']" ^
--globals "{'bonus':'2'}"
Result
42