From 0d07cf9dddbcfc31837b57631ca9987288ede15c Mon Sep 17 00:00:00 2001 From: Charles Krinke Date: Mon, 9 Jun 2008 01:06:59 +0000 Subject: 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/. --- OpenSim/Region/ScriptEngine/Common/LSL_Types.cs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Common/LSL_Types.cs index f8650a0..ab3cba8 100644 --- a/OpenSim/Region/ScriptEngine/Common/LSL_Types.cs +++ b/OpenSim/Region/ScriptEngine/Common/LSL_Types.cs @@ -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; -- cgit v1.1