Warp 10 types
WarpScript is a strongly typed language. The output of WarpScript is the stack, represented as a JSON. Some objects are not serializable, i.e. you will see "null" output. In the first WarpScript tutorial, you learned TYPEOF
function to check the type of objects on the stack.
Common types
The bold ones could be represented in the JSON stack output.
Type | Use Case |
---|---|
BITSET | Used for binary operation (decode a CAN bus frame for example) |
BOOLEAN | |
BYTES | Bytes array, raw binary data storage |
COUNTER | Atomic long. |
DOUBLE | |
GEOSHAPE | Polygon drawing on earth |
GTS | |
LIST | |
LONG | |
MACRO | |
MAP | |
MAPPER | Piece of custom Warpscript |
MATRIX | Math matrix |
NULL | |
PFONT | Font object. Linked to Pgraphics. |
PGRAPHICS | Pgraphics Image object. Could be rendered to png. |
PIMAGE | Pgraphics layer object. |
PSHAPE | Pgraphics shape object |
REDUCER | Piece of custom Warpscript |
SET | A collection of unique values |
STRING | |
VECTOR | Math vector |
VLIST | Vector, used for example to produce data bags in Pig |
Conversion table
This conversion table is updated on each version of Warp 10.
Input | Functions | Output |
---|
More about serialization
In Warp 10, the JSON serialization is the most obvious one, the default one.
For GTS, ENCODER, or lists thereof, Warp 10 has a very efficient serialization. This is called wrapping. Data is compressed then represented as a STRING. In the following example, a GTS with 10000 booleans and their timestamps is represented in JSON and in a wrapped string.
You may also need to save a stack. In this case, you can SNAPSHOT
the stack to build a WarpScript code snippet (a one line STRING) from the STACK, the produced WarpScript code will recreate the initial stack when execute. It works with lots of object type.
The Warpscript output includes a wrapped GTS and the UNWRAP function, then it builds a list and convert the list into a SET.
The resulting string can be passed to another remote Warp 10 server and evaluated with EVAL
function to rebuild the stack.