Note that there are some explanatory texts on larger screens.

plurals
  1. PODetect function's caller's ScriptEngine
    primarykey
    data
    text
    <p>I'm trying to determine a function's result depending on the caller's ScriptEngine:</p> <pre><code>//JScript function doSomething() { if (ScriptEngine() === "VBScript") return "this is VBScript"; else return "this is JScript"; } </code></pre> <p>But the results are:</p> <pre><code>//JScript var str = doSomething(); //"this is JScript" //VBScript Dim str : str = DoSomething() '"this is JScript" </code></pre> <p>The <code>ScriptEngine()</code> function always returns its caller's engine name, but I would like to know the <code>doSomething()</code> caller's engine name (without passing it as a parameter). Is there any way to do this in ASP?</p> <p>The motivation behind this is that I wrote a JSON utility class to use in an ASP site. The parsing of the JSON string is done via <code>eval</code> (using the validation that I found in <a href="https://stackoverflow.com/questions/2583472/regex-to-validate-json">this</a> answer).</p> <p>The result of <code>eval</code> is a JScript object (with JScript arrays and JScript dates as properties). Then the user must specify a flag to tell the function if he wants the pure JScript object or if he wants a VBScript object (with arrays and dates converted to their VBScript equivalent). I would like to eliminate that parameter.</p> <pre><code>//JScript function parseJson(jsonString, isJsObject) { var parsedObject = parsingLogic(jsonString); if (!isJsObject) //Would like to replace by engine check convertVbProperties(parsedObject); return parsedObject; } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload