Adds tostring and type functions
This commit is contained in:
@@ -46,7 +46,7 @@ namespace Upsilon.BaseTypes
|
||||
while (baseEnumerator.MoveNext())
|
||||
{
|
||||
var key = baseEnumerator.Current;
|
||||
if (key.Type == Type.Nil)
|
||||
if (key == null || key.Type == Type.Nil)
|
||||
break;
|
||||
var value = BaseIterator.GetValueFromIndex(key);
|
||||
if (value.Type == Type.Nil)
|
||||
|
||||
@@ -37,7 +37,6 @@ namespace Upsilon.StandardLibraries
|
||||
return new PairsScriptIterator(table);
|
||||
}
|
||||
|
||||
|
||||
[StandardLibraryScriptFunction("tonumber")]
|
||||
public ScriptNumber ToNumber(ScriptString obj)
|
||||
{
|
||||
@@ -51,5 +50,18 @@ namespace Upsilon.StandardLibraries
|
||||
return new ScriptNumberLong(long.Parse(str));
|
||||
}
|
||||
}
|
||||
|
||||
[StandardLibraryScriptFunction("tostring")]
|
||||
public ScriptString ToString(ScriptType obj)
|
||||
{
|
||||
return new ScriptString(obj.ToString());
|
||||
}
|
||||
|
||||
[StandardLibraryScriptFunction("type")]
|
||||
public ScriptString Type(ScriptType obj)
|
||||
{
|
||||
return new ScriptString(obj.Type.ToString());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user