Fixed string issue in compiler

afrisby
Tedd Hansen 2008-01-01 11:28:56 +00:00
parent b4c9b6bd19
commit 9eba3d2f89
2 changed files with 49 additions and 35 deletions

View File

@ -31,7 +31,7 @@ using System;
namespace OpenSim.Region.ScriptEngine.Common namespace OpenSim.Region.ScriptEngine.Common
{ {
[Serializable] [Serializable]
public class LSL_Types public partial class LSL_Types
{ {
// Types are kept is separate .dll to avoid having to add whatever .dll it is in it to script AppDomain // Types are kept is separate .dll to avoid having to add whatever .dll it is in it to script AppDomain
@ -411,7 +411,7 @@ namespace OpenSim.Region.ScriptEngine.Common
output = "["; output = "[";
foreach (object o in m_data) foreach (object o in m_data)
{ {
if (o.GetType().ToString() == "System.String") if (o is System.String)
{ {
output = output + "\"" + o + "\", "; output = output + "\"" + o + "\", ";
} }
@ -438,12 +438,26 @@ namespace OpenSim.Region.ScriptEngine.Common
output = output + o.ToString(); output = output + o.ToString();
} }
return output; return output;
} }
public class String public struct String
{ {
// Our own little string
internal string actualString;
public static implicit operator bool(String mString)
{
if (mString.actualString.Length == 0)
return true;
return false;
}
public override string ToString()
{
return actualString;
}
}
} }
} }
} }
}

View File

@ -47,7 +47,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
dataTypes.Add("void", "void"); dataTypes.Add("void", "void");
dataTypes.Add("integer", "int"); dataTypes.Add("integer", "int");
dataTypes.Add("float", "double"); dataTypes.Add("float", "double");
dataTypes.Add("string", "LSL_Types.String"); dataTypes.Add("string", "string");
dataTypes.Add("key", "string"); dataTypes.Add("key", "string");
dataTypes.Add("vector", "LSL_Types.Vector3"); dataTypes.Add("vector", "LSL_Types.Vector3");
dataTypes.Add("rotation", "LSL_Types.Quaternion"); dataTypes.Add("rotation", "LSL_Types.Quaternion");