Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Pass a List to another script ?

GeeJAnn Blackadder
Registered User
Join date: 12 Sep 2007
Posts: 14
10-19-2009 09:54
I am attempting to pass a list from one script ot another. I an using llMessageLinked.
the resulting list in the target script seems to contain all the data but has become a single entry ? Any suggestions ?

sending script
list All_Texture_Sphere = [];
All_Texture_List = (string)All_Texture_Sphere;
llMessageLinked(LINK_SET ,999,All_Texture_List,"";); // Send the list

receiving script
link_message(integer sender, integer Action_Code, string Message, key NumberRange)
list All_Texture = [];
All_Texture = (list)Message;
Total_Texture = llGetListLength(All_Texture);

The result is that Total_Texture is a 1.
Meade Paravane
Hedgehog
Join date: 21 Nov 2006
Posts: 4,845
10-19-2009 09:56
From: GeeJAnn Blackadder
list All_Texture_Sphere = [];
All_Texture_List = (string)All_Texture_Sphere;
llMessageLinked(LINK_SET ,999,All_Texture_List,"";); // Send the list

You're sending an empty list on purpose or you just edited out the contents for ease of posting here?

Either way, I don't think you can just cast from a list to a string and back. Use llList2CSV to convert a list to a string and llCSV2List to convert it back in the receiver..
_____________________
Tired of shouting clubs and lucky chairs? Vote for llParcelSay!!!
- Go here: http://jira.secondlife.com/browse/SVC-1224
- If you see "if you were logged in.." on the left, click it and log in
- Click the "Vote for it" link on the left
GeeJAnn Blackadder
Registered User
Join date: 12 Sep 2007
Posts: 14
Thank you
10-19-2009 09:58
1. yes the empty list was an example

2. I will try that conversion ... that is perfect
Indeterminate Schism
Registered User
Join date: 24 May 2008
Posts: 236
10-20-2009 04:52
Using these CSV functions is the simplest method as long as your data itself CONTAINS NO COMMAS. If you have embedded commas LSL still has the functions you need:

list AList = [];
string AString = llDumpList2String(AList, "|";); // Or any other character-sequence that isn't embedded in your data
list AnotherList = llParseList2String(AString, ["|"], []); // Mutatis Mutandis.
list AListWithNulls = llParseStringKeepNulls(AString, ["|"], []); // Works the same as above but keeps 'null' values