Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

converting MOO lists into TCL lists

Status
Not open for further replies.

splinter98

Programmer
Feb 27, 2005
2
GB
Ok what i want to do is convert a list from the language MOO to a list that tcl can understand. this is a sample of a MOO list: {test, boo} And what i want it to be converted to: {test boo} Now the lists i want to use get even more complicated like: {{test, boo}, {foo, bar}} which need to be converted to a format that i can retrive both parts of the information (eg test and boo) so that i can continue my code. What is the eaiset method of doing this and what is the easiest method of using them afterwards thanks
 
It looks like the conversion is nothing more than losing the commas: set TclList [string map {, ""} $MOOList]. As to how you use Tcl Lists, I suggest you start by reading the help page
Tcl >> Tcl Built-In Commands >> List Handling

--------------------------------------------------------------------------------

List Handling
concat - Join lists together
join - Create a string by joining together list elements
lindex - Retrieve an element from a list
linsert - Insert elements into a list
list - Create a list
llength - Count the number of elements in a list
lrange - Return one or more adjacent elements from a list
lreplace - Replace elements in a list with new elements
lsearch - See if a list contains a particular element
lsort - Sort the elements of a list
split - Split a string into a proper Tcl list

Bob Rashkin
rrashkin@csc.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top