Lasso Soft Inc. > Home

[lp_var_pack]

Linklp_var_pack
AuthorBil Corry
CategoryVariable
Version8.x
LicensePublic Domain
Posted02 Dec 2005
Updated07 Sep 2006
More by this author...

Description

Packs variables into compact, ASCII-safe bundles.  Optionally can encrypt data.

Note: requires [lp_var_unpack] to unpack the variable.

Sample Usage

'
';
var:'test' = (array: 1, 2, 3, 4, 5);
$test;
'
'; ($test->serialize)->size; '
'; var:'pack' = (lp_var_pack: $test, 'secret'); $pack->size; '
'; var:'unpack' = (lp_var_unpack: $pack, 'secret'); $unpack; '
'; '
';

Source Code

Click the "Download" button below to retrieve a copy of this tag, including the complete documentation and sample usage shown on this page. Place the downloaded ".inc" file in your LassoStartup folder, restart Lasso, and you can begin using this tag immediately.

[

define_tag:'lp_var_pack',
	-description='Packs variables into compact, ASCII-safe bundles.  Optionally can encrypt data.',
	-priority='replace',
	-required='object_to_pack',
	-optional='password',
	-optional='encodehex',
	-optional='encodebase64',
	-optional='noencode';

	if: (local_defined:'password');
		local:'pack' = (encrypt_blowfish2:-seed=#password,(compress:(#object_to_pack->serialize)));
	else;
		local:'pack' = (compress:(#object_to_pack->serialize));
	/if;

	if: (local_defined:'noencode');
		return: #pack;
	else: (local_defined:'encodehex');
		return: (encode_hex: #pack);
	else; // base64
		return: (encode_base64: #pack);
	/if;

/define_tag;

]

Related Tags

Comments

No comments

Please log in to comment

Subscribe to the LassoTalk mail list

LassoSoft Inc. > Home

 

 

©LassoSoft Inc 2015 | Web Development by Treefrog Inc | PrivacyLegal terms and Shipping | Contact LassoSoft