Skip to main content

Call byte code function

Executes bytecode and calls the specified function

Function CallByteCodeFunction(Val Lua, Val Bytecode, Val FunctionName, Val Parameters = Undefined, Val Packages = Undefined, Val Variables = Undefined) Export

ParameterCLI optionTypeRequiredDescription
Lua--luaArbitraryLua AddIn or Lua version to run
Bytecode--codeString, BinaryDataByte code or file path
FunctionName--funcStringFunction name or path in module.func format
Parameters--paramsMap Of KeyAndValueFunction parameters, if necessary
Packages--packagesMap Of KeyAndValuePackages: key > name, value > code or file path
Variables--globalsMap Of KeyAndValueModule global variables, if necessary
Returns

Arbitrary - Calling result

tip

Similarly to separate calls of ExecuteByteCode, AttachPackageFromString, SetGlobalVariable, and CallFunction

Parameters with Binary data type can also accept file paths on disk and URLs


1C:Enterprise/OneScript code example
Bytecode = OPI_Lua.CompileCodeFromString("Lua54", "function sub(a, b) return a - b end");

Parameters = New Array;
Parameters.Add(10);
Parameters.Add(3);

Result = OPI_Lua.CallByteCodeFunction("Lua54", Bytecode, "sub", Parameters);
# JSON data can also be passed as a path to a .json file

oint lua CallByteCodeFunction \
--lua "Lua54" \
--code "/tmp/nqjoas5n.ymg" \
--func "mul" \
--params "['6','7']" \
--globals "{'bonus':'2'}"
Result
7