removed useless _ folders
This commit is contained in:
3
Pair_List_Parser/Pair_List_Parser.sol
Normal file
3
Pair_List_Parser/Pair_List_Parser.sol
Normal file
@@ -0,0 +1,3 @@
|
||||
<Solution name="Pair_List_Parser">
|
||||
<Project name="Pair_List_Parser" path="Pair_List_Parser\Pair_List_Parser.prj" active="true"/>
|
||||
</Solution>
|
||||
@@ -0,0 +1,26 @@
|
||||
// :CATEGORY:Utility
|
||||
// :NAME:Pair_List_Parser
|
||||
// :AUTHOR:kagefumi
|
||||
// :CREATED:2010-01-10 05:20:56.000
|
||||
// :EDITED:2013-09-18 15:38:59
|
||||
// :ID:602
|
||||
// :NUM:824
|
||||
// :REV:1.0
|
||||
// :WORLD:Second Life
|
||||
// :DESCRIPTION:
|
||||
// Test Script
|
||||
// :CODE:
|
||||
default
|
||||
|
||||
{
|
||||
|
||||
state_entry()
|
||||
|
||||
{
|
||||
|
||||
list pair_list = [];
|
||||
|
||||
pair_list = plSet(pair_list, ["aaa"], [1.23]);
|
||||
|
||||
pair_list = plSet(pair_list, ["bbb", "ccc"], [<1.11, 2.22, 3.33>, "hogehoge"]);
|
||||
|
||||
205
Pair_List_Parser/Pair_List_Parser/Object/Pair_List_Parser_2.lsl
Normal file
205
Pair_List_Parser/Pair_List_Parser/Object/Pair_List_Parser_2.lsl
Normal file
@@ -0,0 +1,205 @@
|
||||
// :CATEGORY:Utility
|
||||
// :NAME:Pair_List_Parser
|
||||
// :AUTHOR:kagefumi
|
||||
// :CREATED:2010-01-10 05:20:56.000
|
||||
// :EDITED:2013-09-18 15:38:59
|
||||
// :ID:602
|
||||
// :NUM:825
|
||||
// :REV:1.0
|
||||
// :WORLD:Second Life
|
||||
// :DESCRIPTION:
|
||||
// The Main Script
|
||||
// :CODE:
|
||||
//===============================================
|
||||
|
||||
//
|
||||
|
||||
// Pair List.
|
||||
|
||||
//
|
||||
|
||||
// Example
|
||||
|
||||
// pair_list
|
||||
|
||||
// => ["MicroSoft", "Xbox360", "Sony", "PlayStation3"];
|
||||
|
||||
// plGet(pair_list, ["Sony"] );
|
||||
|
||||
// => ["PlayStation3"]
|
||||
|
||||
// plSet(pair_list, ["Apple"], ["iPhone"]);
|
||||
|
||||
// => ["MicroSoft", "Xbox360", "Sony", "PlayStation3", "Apple", "iPhone"]
|
||||
|
||||
// plKeys(pair_list);
|
||||
|
||||
// => ["MicroSoft", "Sony"]
|
||||
|
||||
// plValues(pair_list);
|
||||
|
||||
// => ["Xbox360", "PlayStation3"]
|
||||
|
||||
//
|
||||
|
||||
//===============================================
|
||||
|
||||
|
||||
|
||||
//
|
||||
|
||||
// Gets elements from pair list.
|
||||
|
||||
//
|
||||
|
||||
list plGet(list pair_list, list keys)
|
||||
|
||||
{
|
||||
|
||||
list results = [];
|
||||
|
||||
integer keys_length = llGetListLength(keys);
|
||||
|
||||
integer pair_list_length = llGetListLength(pair_list);
|
||||
|
||||
integer i;
|
||||
|
||||
for (i = 0; i < keys_length; i++)
|
||||
|
||||
{
|
||||
|
||||
string xkey = llList2String(keys, i);
|
||||
|
||||
integer key_index = llListFindList(pair_list, [xkey]);
|
||||
|
||||
if (0 <= key_index && key_index <pair_list_length - 1)
|
||||
|
||||
{
|
||||
|
||||
integer type = llGetListEntryType(pair_list, key_index + 1);
|
||||
|
||||
if (type == TYPE_FLOAT)
|
||||
|
||||
{
|
||||
|
||||
results += llList2Float(pair_list, key_index + 1);
|
||||
|
||||
}
|
||||
|
||||
else if (type == TYPE_INTEGER)
|
||||
|
||||
{
|
||||
|
||||
results += llList2Integer(pair_list, key_index + 1);
|
||||
|
||||
}
|
||||
|
||||
else if (type == TYPE_INVALID)
|
||||
|
||||
{
|
||||
|
||||
results += "???";
|
||||
|
||||
}
|
||||
|
||||
else if (type == TYPE_KEY)
|
||||
|
||||
{
|
||||
|
||||
results += llList2Key(pair_list, key_index + 1);
|
||||
|
||||
}
|
||||
|
||||
else if (type == TYPE_ROTATION)
|
||||
|
||||
{
|
||||
|
||||
results += llList2Rot(pair_list, key_index + 1);
|
||||
|
||||
}
|
||||
|
||||
else if (type == TYPE_STRING)
|
||||
|
||||
{
|
||||
|
||||
results += llList2String(pair_list, key_index + 1);
|
||||
|
||||
}
|
||||
|
||||
else if (type == TYPE_VECTOR)
|
||||
|
||||
{
|
||||
|
||||
results += llList2Vector(pair_list, key_index + 1);
|
||||
|
||||
}
|
||||
|
||||
else
|
||||
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
else
|
||||
|
||||
{
|
||||
|
||||
llSay(DEBUG_CHANNEL, "Invalid element in " + llDumpList2String(pair_list, ","));
|
||||
|
||||
results += "???";
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return results;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
|
||||
// Sets elements to pair list.
|
||||
|
||||
//
|
||||
|
||||
list plSet(list pair_list, list keys, list values)
|
||||
|
||||
{
|
||||
|
||||
integer keys_length = llGetListLength(keys);
|
||||
|
||||
integer values_length = llGetListLength(values);
|
||||
|
||||
integer i;
|
||||
|
||||
for (i = 0; (i < keys_length) && (i < values_length); i++)
|
||||
|
||||
{
|
||||
|
||||
string xkey = llList2String(keys, i);
|
||||
|
||||
integer index = llListFindList(pair_list, [xkey]);
|
||||
|
||||
integer type = llGetListEntryType(values, i);
|
||||
|
||||
if (0 <= index)
|
||||
|
||||
{
|
||||
|
||||
if (type == TYPE_FLOAT)
|
||||
|
||||
{
|
||||
|
||||
float value = llList2Float(values, i);
|
||||
|
||||
pair_list = llListReplaceList(pair_list, [value], index + 1, index + 1);
|
||||
|
||||
}
|
||||
|
||||
else if (type == TYPE_INTEGER)
|
||||
|
||||
{
|
||||
8
Pair_List_Parser/Pair_List_Parser/Pair_List_Parser.prj
Normal file
8
Pair_List_Parser/Pair_List_Parser/Pair_List_Parser.prj
Normal file
@@ -0,0 +1,8 @@
|
||||
<Project name="Pair_List_Parser" guid="D7E40C04-6C00-1014-B904-200204C60A89">
|
||||
<Object name="Object" guid="D7E40CE6-6C00-1014-B904-200204C60A89">
|
||||
<Script name="Pair_List_Parser_1.lsl" guid="D7E430D2-6C00-1014-B904-200204C60A89">
|
||||
</Script>
|
||||
<Script name="Pair_List_Parser_2.lsl" guid="D7E44330-6C00-1014-B904-200204C60A89">
|
||||
</Script>
|
||||
</Object>
|
||||
</Project>
|
||||
Reference in New Issue
Block a user