Skip to content

Commit

Permalink
更新tolua#到1.0.6.273版
Browse files Browse the repository at this point in the history
  • Loading branch information
jarjin2000 committed Dec 4, 2016
1 parent 272fc10 commit 19c9d45
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 3 deletions.
27 changes: 25 additions & 2 deletions Assets/LuaFramework/ToLua/Core/LuaTable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,17 @@ public object this[int key]
}
}

public void ForEach(Action<object> action)
{
using (var iter = this.GetEnumerator())
{
while (iter.MoveNext())
{
action(iter.Current);
}
}
}

public IEnumerator<object> GetEnumerator()
{
return new Enumerator(this);
Expand All @@ -345,10 +356,12 @@ class Enumerator : IEnumerator<object>
LuaState state;
int index = 1;
object current = null;
int top = -1;

public Enumerator(LuaArrayTable list)
{
state = list.state;
top = state.LuaGetTop();
state.Push(list.table);
}

Expand Down Expand Up @@ -377,7 +390,11 @@ public void Reset()

public void Dispose()
{
state.LuaPop(1);
if (state != null)
{
state.LuaSetTop(top);
state = null;
}
}
}
}
Expand Down Expand Up @@ -444,10 +461,12 @@ class Enumerator : IEnumerator<DictionaryEntry>
{
LuaState state;
DictionaryEntry current = new DictionaryEntry();
int top = -1;

public Enumerator(LuaDictTable list)
{
state = list.state;
top = state.LuaGetTop();
state.Push(list.table);
state.LuaPushNil();
}
Expand Down Expand Up @@ -492,7 +511,11 @@ public void Reset()

public void Dispose()
{
state.LuaPop(1);
if (state != null)
{
state.LuaSetTop(top);
state = null;
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion Assets/LuaFramework/ToLua/Core/ObjectPool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public object TryGetValue(int index)
return list[index].obj;
}

return false;
return null;
}

public object Remove(int pos)
Expand Down
3 changes: 3 additions & 0 deletions ReadMe.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ XlsxToLua: https://github.com/zhangqi-ulua/XlsxToLua
UnityHello: https://github.com/woshihuo12/UnityHello
Excel配置:https://github.com/sy-yanghuan/proton

//-------------2016-12-05-------------
(1)更新tolua#到1.0.6.273版

//-------------2016-11-03-------------
(1)更新tolua#到1.0.6.266版

Expand Down

0 comments on commit 19c9d45

Please sign in to comment.