INTEGRAL DSL Reference Guide
Jump directly to:
::my.app.Interpret(string)
::my.app.InterpretViaFile(filename)
These functions interpret an INTEGRAL DSL program. The Interpret function interprets INTEGRAL DSL source code stored in the supplied string variable while InterpretViaFile interprets source code (or bytecode) stored in the supplied file. The two functions are identical otherwise.
Parameters
string
A string representing INTEGRAL DSL source code to be interpreted. This parameter applies only to Interpret.
filename
A string containing the name (path) of the INTEGRAL DSL program to be interpreted. This path is relative to the current working directory. This parameter applies only to InterpretViaFile.
Return Value
The function returns DV_RET_OK on success and DV_RET_ERR on failure.
- const DV_RET_ERR = 0 — failure
- const DV_RET_OK = 1 — success
Example 1
local prog_1 = "local x = 6; ::my.app.Print(\"x^2 = \" + (x * x) + \"<br />\");"; local prog_2 = "local t; for (t = 0.0; t < 3.5; t += 0.5) ::my.app.Print(\"sin(\" + t + \") = \" + sin(t) + \"<br />\");"; ::my.app.Interpret(prog_1); ::my.app.Interpret(prog_2);
Result:
x^2 = 36 sin(0) = 0 sin(0.5) = 0.479426 sin(1) = 0.841471 sin(1.5) = 0.997495 sin(2) = 0.909297 sin(2.5) = 0.598472 sin(3) = 0.14112