- Method encode_value
Code a value into a string.
This function takes a value, and converts it to a string. This string can then be saved, sent to another Pike process, packed or used in any way you like. When you want your value back you simply send this string to decode_value() and it will return the value you encoded.
Almost any value can be coded, mappings, floats, arrays, circular structures etc.
codecis specified, it's used as the codec for the encode. If none is specified, then one is instantiated through
master()->Encoder(). As a compatibility fallback, the master itself is used if it has no
returns UNDEFINED for an object,
val = o->encode_object(o)will be called. The returned value will be passed to
o->decode_object(o, val)when the object is decoded.
When only simple types like int, floats, strings, mappings, multisets and arrays are encoded, the produced string is very portable between pike versions. It can at least be read by any later version.
The portability when objects, programs and functions are involved depends mostly on the codec. If the byte code is encoded, i.e. when Pike programs are actually dumped in full, then the string can probably only be read by the same pike version.
- See also