Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

multiple variables from a return

Tarak Voss
Meanderer
Join date: 14 Oct 2006
Posts: 330
12-20-2008 21:17
Can I do something like this:

string st_textureStore;
integer in_gridType;
interger in_currentSheet;

getTextureGrid(st_textureStore, in_gridType, in_currentSheet)
{
in_currentSheet = (in_currentSheet+1);
.........
return (st_textureStore,in_gridType,in_gridType);
}

default
touch_start(integer touch_num)
{
.......
getTextureGrid(, , 8);
// I would now have a new value for the three variables:
// string st_textureStore
// integer in_gridType
// interger in_currentSheet
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
12-20-2008 21:26
It looks like you want to use global variables anyway, so why return the values also? Anyway, you can return lists, and extract the list's elements after getting it back. Like:

CODE

list func1()
{
return [ 1, "my dog", 3.0 ];
}

func2()
{
list returnedList = func1();
integer elem1 = llList2Integer(returnedList, 0);
string elem2 = llList2String(returnedList, 1);
float elem3 = llList2Float(returnedList, 2);
}


See http://www.lslwiki.net/lslwiki/wakka.php?wakka=list
Tarak Voss
Meanderer
Join date: 14 Oct 2006
Posts: 330
12-20-2008 22:19
thanks for that