Argument Multiplexing
De DigiWiki.
Eg, sending a linked message:
list command=["DOSOMETHING",llGetKey(),llGetPos(),TRUE]; llMessageLinked( LINK_ROOT, 0, llDumpList2String(command, "-=-"), "" );
This sends command "DOSOMETHING" followed by a key, a vector and an integer.
When you're receiving this, you can do this:
link_message(integer sender_num, integer num, string str, key id) { list Arguments = llParseStringKeepNulls( str, ["-=-"], [] ); string Command = llList2String( Arguments, 0 ); if( Command == "DOSOMETHING" ) { key kSenderKey = (key)llList2String( Arguments, 1 ); vector vSenderPos = (vector)llList2String( Arguments, 2 ); integer bSomeInteger = (integer)llList2String( Arguments, 3 ); ... } else ... }
The great thing about this is that you can send any data type, including strings with spaces.