C Result = *VARIABLE_TO_SCRIPT(P varFrame[,options as c[,stringTagMap as c]])
Xbasic script to re-create variables that were inside the passed frame/pointer
(optional) w : Generate with statements
(optional) Control string tag names
Create a script that would initialized the variables in the variable frame - option flag 'w' - generate with statements.
Create an Xbasic script to re-create the variables in the passed variable frame (pointer variable).
The function takes a dot variable and serializes it as an Xbasic script. The dot variable can be reconstituted by executing the generated script. Contrast this with property_to_string() and property_to_blob(), which also serialize a dot variable.
dim p as p p.name = "alpha" p.city = "boston" ?*variable_to_script(p) = DIM name as C = "alpha" DIM city as C = "boston" dim p2 as p p2.name = "alpha" dim p2.array as p p2.array.prop1 = "prop1" p2.array.prop2 = "prop2" p2.array.prop1 = "prop3" p2.array.prop2 = "prop4" ?*variable_to_script(p2) = DIM name as C = "alpha" DIM array as P DIM array.prop1 as C = "prop1" DIM array.prop2 as C = "prop2" DIM array.prop1 as C = "prop3" DIM array.prop2 as C = "prop4" 'using the 'w' flag you get cleaner, easier to read code ?*variable_to_script(p2,"w") = DIM name as C = "alpha" DIM array as P with array .prop1 = "prop1" .prop2 = "prop2" end with with array .prop1 = "prop3" .prop2 = "prop4" end with p3.colors = comma_to_crlf("alpha,beta,gamma") p3.html = "this is some html" + crlf() + "second line" ?*variable_to_script(p3) = DIM colors as C = <<%str% alpha beta gamma%str% DIM html as C = <<%str% this is some html second line%str% 'in the above example, a5 chose to use 'str' as the long string delimiter. 'By passing in a map (of property name to string delimiter), ' you can specify what delimiter to use for various property names ' Notice that the .html property is now delimited using %html%, ' not %str% as in the above example ?*variable_to_script(p3,"",comma_to_crlf("*html*|%html%,*Xbasic*|%code%,*serverside*|%code%")) = DIM colors as C = <<%str% alpha beta gamma%str% DIM html as C = <<%html% this is some html second line%html%