execScriptRestricted()

This function, like execScript(), allows for execution of a script during runtime. Use this function to run void main-functions which have no return value. Contrasting to execScript() the functions that can be used inside the executed script are limited to provide better security against insertion of malicious code.

Synopsis

int execScriptRestricted(string script, [dyn_string dollars [,<type> <arg> ...]])

Parameters

Parameter Description
script The executed script
dollars The $parameter of the script
arg The parameters of any existing main function

Return value

The function returns 0 if an execution has been successful or in event of an error, -1.

Error

An error can be, for example, a syntax error of a script or a missing main function.

Description

Functionality is like execScript(), it allows the user to execute a script during runtime. The functions allowed within the script are greatly reduced from the unrestricted function.

Note: This function can be used in restricted mode.
  • UI Functions

  • functions from a CTRL-extension

Function-types that can not be used:

Example

The following script adds the values 17 and 8.

main()
{
  int rc = execScriptRestricted(
      "int main(int a, int b)" +
      "{" +
      "  int val;" +
      "  val = 3;" +
      "  DebugN(\"$ Value:\", $val1 + \" val:\", a + b );" +
      "}",
      makeDynString("$val1:12345"), 17, 8);
  DebugN(rc);
}

Assignment

Miscellaneous functions, waiting CONTROL function

Availability

CTRL