diff options
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 33 |
1 files changed, 27 insertions, 6 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 7c21ba9..86ee28a 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -10565,9 +10565,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
10565 | } | 10565 | } |
10566 | } | 10566 | } |
10567 | 10567 | ||
10568 | public static string GetLine(UUID assetID, int line, int maxLength) | 10568 | /// <summary> |
10569 | /// Get a notecard line. | ||
10570 | /// </summary> | ||
10571 | /// <param name="assetID"></param> | ||
10572 | /// <param name="line">Lines start at index 0</param> | ||
10573 | /// <returns></returns> | ||
10574 | public static string GetLine(UUID assetID, int lineNumber) | ||
10569 | { | 10575 | { |
10570 | if (line < 0) | 10576 | if (lineNumber < 0) |
10571 | return ""; | 10577 | return ""; |
10572 | 10578 | ||
10573 | string data; | 10579 | string data; |
@@ -10579,17 +10585,32 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
10579 | { | 10585 | { |
10580 | m_Notecards[assetID].lastRef = DateTime.Now; | 10586 | m_Notecards[assetID].lastRef = DateTime.Now; |
10581 | 10587 | ||
10582 | if (line >= m_Notecards[assetID].text.Length) | 10588 | if (lineNumber >= m_Notecards[assetID].text.Length) |
10583 | return "\n\n\n"; | 10589 | return "\n\n\n"; |
10584 | 10590 | ||
10585 | data = m_Notecards[assetID].text[line]; | 10591 | data = m_Notecards[assetID].text[lineNumber]; |
10586 | if (data.Length > maxLength) | ||
10587 | data = data.Substring(0, maxLength); | ||
10588 | 10592 | ||
10589 | return data; | 10593 | return data; |
10590 | } | 10594 | } |
10591 | } | 10595 | } |
10592 | 10596 | ||
10597 | /// <summary> | ||
10598 | /// Get a notecard line. | ||
10599 | /// </summary> | ||
10600 | /// <param name="assetID"></param> | ||
10601 | /// <param name="line">Lines start at index 0</param> | ||
10602 | /// <param name="maxLength">Maximum length of the returned line. Longer lines will be truncated</para> | ||
10603 | /// <returns></returns> | ||
10604 | public static string GetLine(UUID assetID, int lineNumber, int maxLength) | ||
10605 | { | ||
10606 | string line = GetLine(assetID, lineNumber); | ||
10607 | |||
10608 | if (line.Length > maxLength) | ||
10609 | line = line.Substring(0, maxLength); | ||
10610 | |||
10611 | return line; | ||
10612 | } | ||
10613 | |||
10593 | public static void CacheCheck() | 10614 | public static void CacheCheck() |
10594 | { | 10615 | { |
10595 | foreach (UUID key in new List<UUID>(m_Notecards.Keys)) | 10616 | foreach (UUID key in new List<UUID>(m_Notecards.Keys)) |