diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs index 9de7c0eede..39d8473e0f 100644 --- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs +++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs @@ -2779,10 +2779,55 @@ namespace OpenSim.Region.ScriptEngine.Common return new LSL_Types.Vector3(World.RegionInfo.RegionLocX * Constants.RegionSize, World.RegionInfo.RegionLocY * Constants.RegionSize, 0); } - public LSL_Types.list llListInsertList(LSL_Types.list dest, LSL_Types.list src, int start) + /// + /// Insert the list identified by into the + /// list designated by such that the first + /// new element has the index specified by + /// + + public LSL_Types.list llListInsertList(LSL_Types.list dest, LSL_Types.list src, int index) { + + LSL_Types.list pref = null; + LSL_Types.list suff = null; + m_host.AddScriptLPS(1); - return dest.GetSublist(0, start - 1) + src + dest.GetSublist(start, -1); + + if(index < 0) + { + index = index+src.Length; + if(index < 0) + { + index = 0; + } + } + + if(index != 0) + { + pref = dest.GetSublist(0,index-1); + if(index < dest.Length) + { + suff = dest.GetSublist(index,-1); + return pref + src + suff; + } + else + { + return pref + src; + } + } + else + { + if(index < dest.Length) + { + suff = dest.GetSublist(index,-1); + return src + suff; + } + else + { + return src; + } + } + } ///