Function.Unofficial.Script.Eval

From GAB Help
Jump to: navigation, search

Evaluation Script ; can use with strings, integers, or boolean statements

Syntax

function.Unofficial.Script.Eval(Passed Function, f Ret)

Arguments

Passed Function

String, boolean statement of action

F Return

String Return of evaluation/action

Example

#1
Program.Sub.Main.Start
 variable.local.a.declare(float)
 variable.local.b.declare(float)
 variable.local.c.declare(float)
 variable.local.r.declare(float)
 variable.local.a.set(2)
 variable.local.b.set(3)
 variable.local.c.set(4)
 'variable.local.s.set("[variable.local.a]*[variable.local.b]^[variable.local.c]")
function.unofficial.script.eval("[variable.local.a]*[variable.local.b]^
[variable.local.c]",variable.local.r)
function.intrinsic.ui.msgbox(variable.local.r)
'this should give 162
                    function.unofficial.script.eval("([variable.local.a]*[variable.local.b])^[variab le.local.c]",variable.local.r)
function.intrinsic.ui.msgbox(variable.local.r)
'this should give 1296
Program.Sub.Main.End

#2
Program.Sub.Main.Start
 variable.local.a.declare(long)
 variable.local.b.declare(long)
 variable.local.c.declare(long)
 variable.local.s.declare(string)
 variable.local.r.declare(long)
 variable.local.a.set(1)
 variable.local.b.set(2)
 variable.local.c.set(3)
 function.intrinsic.string.concat(variable.local.b,"=",variable.local.b," and ",variable.local.a,"=",variable.local.c,variable.local.s)
 function.unofficial.script.eval("[variable.local.s]",variable.local.r)
 'returns -1 for false
 function.intrinsic.control.if(variable.local.r,"=",0)
 function.intrinsic.string.concat("The condition ",variable.local.s," was false",variable.local.s)
 function.intrinsic.ui.msgbox(variable.local.s)
 function.intrinsic.control.elseif(variable.local.r,"<>",0)
 function.intrinsic.string.concat("The condition ",variable.local.s," was true",variable.local.s)
 function.intrinsic.ui.msgbox(variable.local.s)
 function.intrinsic.control.endif
function.intrinsic.string.concat(variable.local.b,"=",variable.local.b," and “,variable.local.a,"=",variable.local.a,variable.local.s)
function.unofficial.script.eval("[variable.local.s]",variable.local.r)
'returns 0 for true
function.intrinsic.control.if(variable.local.r,"=",0)
function.intrinsic.string.concat("The condition ",variable.local.s," was false",variable.local.s)
function.intrinsic.ui.msgbox(variable.local.s)
function.intrinsic.control.elseif(variable.local.r,"<>",0)
function.intrinsic.string.concat("The condition ",variable.local.s," was true",variable.local.s)
function.intrinsic.ui.msgbox(variable.local.s)
function.intrinsic.control.endif
Program.Sub.Main.End 

Remarks

  • Passed variables in the function must be denoted with square brackets