diff options
author | Charles Krinke | 2008-06-09 01:06:59 +0000 |
---|---|---|
committer | Charles Krinke | 2008-06-09 01:06:59 +0000 |
commit | 0d07cf9dddbcfc31837b57631ca9987288ede15c (patch) | |
tree | 127f36a5d43a7b876da7800953418a19131bc548 /OpenSim/Region | |
parent | * Fixed it so you can do a lot more llDetected* methods in many additional si... (diff) | |
download | opensim-SC-0d07cf9dddbcfc31837b57631ca9987288ede15c.zip opensim-SC-0d07cf9dddbcfc31837b57631ca9987288ede15c.tar.gz opensim-SC-0d07cf9dddbcfc31837b57631ca9987288ede15c.tar.bz2 opensim-SC-0d07cf9dddbcfc31837b57631ca9987288ede15c.tar.xz |
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/.
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Common/LSL_Types.cs | 24 |
1 files changed, 24 insertions, 0 deletions
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 | |||
425 | return new list(tmp); | 425 | return new list(tmp); |
426 | } | 426 | } |
427 | 427 | ||
428 | private void ExtendAndAdd(object o) | ||
429 | { | ||
430 | Array.Resize(ref m_data, Length + 1); | ||
431 | m_data.SetValue(o, Length - 1); | ||
432 | } | ||
433 | |||
434 | public static list operator +(list a, string s) | ||
435 | { | ||
436 | a.ExtendAndAdd(s); | ||
437 | return a; | ||
438 | } | ||
439 | |||
440 | public static list operator +(list a, int i) | ||
441 | { | ||
442 | a.ExtendAndAdd(i); | ||
443 | return a; | ||
444 | } | ||
445 | |||
446 | public static list operator +(list a, double d) | ||
447 | { | ||
448 | a.ExtendAndAdd(d); | ||
449 | return a; | ||
450 | } | ||
451 | |||
428 | public void Add(object o) | 452 | public void Add(object o) |
429 | { | 453 | { |
430 | object[] tmp; | 454 | object[] tmp; |