Skip to main content

Execute code from string

Executes Lua code from the passed string

Function ExecuteCodeFromString(Val Lua, Val Code) Export

ParameterCLI optionTypeRequiredDescription
Lua-ArbitraryLua AddIn or Lua version to run
Code-StringCode as string
Returns

Arbitrary - Code execution result

tip

An error during Lua code execution will throw an exception

Caution

NOCLI: this method is not available in CLI version

1C:Enterprise/OneScript code example
Result = OPI_Lua.ExecuteCodeFromString("Lua54", "return 42");
Result
42