Mantis#1469. Thank you kindly, Mikem for a patch that addresses:

Currently LSL code such as below does not compile on OpenSim, but compiles fine in Second Life:
list mylist = [];
mylist += [1, 2, 3];
mylist += "four";
list newlist = mylist + 5.0;
The problem is that the LSL_Types.list class does not have an operator for adding a string to a list.
I am including a patch which implements adding a string, integer or float to a list.
I am also including tests. The file LSL_TypesTestList.cs belongs in 
OpenSim/Tests/OpenSim/Region/ScriptEngine/Common/.
This commit is contained in:
Charles Krinke
2008-06-09 01:06:59 +00:00
parent 6ecb7c05b3
commit 0d07cf9ddd
2 changed files with 125 additions and 0 deletions

View File

@@ -425,6 +425,30 @@ namespace OpenSim.Region.ScriptEngine.Common
return new list(tmp);
}
private void ExtendAndAdd(object o)
{
Array.Resize(ref m_data, Length + 1);
m_data.SetValue(o, Length - 1);
}
public static list operator +(list a, string s)
{
a.ExtendAndAdd(s);
return a;
}
public static list operator +(list a, int i)
{
a.ExtendAndAdd(i);
return a;
}
public static list operator +(list a, double d)
{
a.ExtendAndAdd(d);
return a;
}
public void Add(object o)
{
object[] tmp;