Unit tests for ipairs and pairs, as well as changing how they handle null. ipairs now breaks at first nil value, pairs skips it
This commit is contained in:
@@ -46,10 +46,10 @@ namespace Upsilon.BaseTypes
|
||||
while (baseEnumerator.MoveNext())
|
||||
{
|
||||
var key = baseEnumerator.Current;
|
||||
if (key == null)
|
||||
if (key.Type == Type.Nil)
|
||||
break;
|
||||
var value = BaseIterator.GetValueFromIndex(key);
|
||||
if (value == null)
|
||||
if (value.Type == Type.Nil)
|
||||
break;
|
||||
yield return new SimpleScriptTable(new List<ScriptType>(){key, value});
|
||||
}
|
||||
@@ -71,7 +71,8 @@ namespace Upsilon.BaseTypes
|
||||
{
|
||||
var key = baseEnumerator.Current;
|
||||
var value = BaseIterator.GetValueFromIndex(key);
|
||||
yield return new SimpleScriptTable(new List<ScriptType>(){key, value});
|
||||
if (value.Type != Type.Nil)
|
||||
yield return new SimpleScriptTable(new List<ScriptType>(){key, value});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user