mirror of
https://github.com/opensim/opensim.git
synced 2026-08-04 16:22:50 +08:00
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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user