DGLux5 script (DG Script) is a small scripting language that looks like JavaScript. Use it when a calculation or a piece of logic is easier to write as code than to build from dataflow blocks.
@ names as scripts. See Page Model.A first script, in a Script block:
var total = 0; for (var i = 1; i <= 10; i++) { total += i; } print("done"); return total; // the block's output becomes 55
| Page | Contents |
|---|---|
| Language Basics | Syntax, statements, functions, types and operators, and how DG Script differs from JavaScript |
| Page Model | Reading and setting component values with @, creating bindings from script, and reusing scripts |
| Debugging | print, printConsole, error messages and profiling |
| Strings and Regular Expressions | String methods, regular expressions, encoding and hashing |
| Numbers and Math | Number conversion, numberFormat patterns, Math functions and constants |
| Dates and Times | DateTime, dateFormat, dateParse, date strings and format patterns |
| Lists and Maps | List methods, sorting, maps and for…in |
| JSON and XML | Parsing and creating JSON and XML |
| Tables | Reading and building DGLux5 tables, and scripts in table blocks |
| Model Functions | Creating, saving, moving and removing components and blocks from script |
| HTTP Requests and Browser Utilities | fetchHttpUrl, promises, blob URLs and calling browser JavaScript |
| Examples | Longer worked examples |
See also:
The sections that used to be on this page have moved: