Nasal library: Difference between revisions

Jump to navigation Jump to search
Line 299: Line 299:
     die("Error calling code compiled loaded from: " ~ filename);
     die("Error calling code compiled loaded from: " ~ filename);
}
}
|example3text = The <code>compile()</code> function also allows you to parse a JSON string into a hash. Simplest example:
|example3 =
var jsonFunc = compile('{"version":"1.2.0","author":{"name":"John"} }');
var json = jsonFunc(); # return hash
logprint(LOG_ALERT, json["version"]); # print "1.2.0"
logprint(LOG_ALERT, json["author"]["name"]); # print "John"
}}
}}


1,376

edits

Navigation menu