1. Common types

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.

TypeUse Case
BITSETUsed for binary operation (decode a CAN bus frame for example)
BYTESBytes array, raw binary data storage
COUNTERAtomic long.
GEOSHAPEPolygon drawing on earth
MAPPERPiece of custom Warpscript
MATRIXMath matrix
PFONTFont object. Linked to Pgraphics.
PGRAPHICSPgraphics Image object. Could be rendered to png.
PIMAGEPgraphics layer object.
PSHAPEPgraphics shape object
REDUCERPiece of custom Warpscript
SETA collection of unique values
VECTORMath vector
VLISTVector, 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.

NEWGTS 1 10000 <% NaN NaN NaN T ADDVALUE %> FOR 'mygts' STORE $mygts WRAP // $mygts //uncomment to see the weight of the JSON representation

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.

NEWGTS //an empty GTS ( 4 5 6 ) // a set SNAPSHOT

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.