Page 1 of 1

Pack(object)

Posted: Wed Apr 11, 2007 8:42 pm
by mr bubbles
Where would this function be used?

I've just never used it.

Posted: Thu Apr 12, 2007 12:08 am
by Yukiko
Examples of its use can be found in \pol\pkg\systems\merchantnodes\textcmd\admin\grabnodes.src in POL 0.95 Distro. Here is the info from \pol\docs\basicem.html

Pack(object)
Parameters: object An object to pack
Explanation: Packs a variable into POL's packed data string format. Note that object references CANNOT be saved with the world, but may be passed to other running scripts, or with an event.
Return values: A string


And from the basic.em file which gives an example of the returned data:

// Pack and Unpack: convert an object to a storable string form
// Pack( 5 ) returns "i5"
// Unpack( "i5" ) returns 5
// strings, integers, reals, and arrays and dictionaries of these can be packed.
Pack( expr );
Unpack( str );

To be honest I too can't think of a time I ever used them. I know I didn't really answer your question but maybe seeing the info will give you ideas of how and why they are used.