Unity tolua遍历 C#中的Dictionary

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/iamlegendary/article/details/86491964

用lua访问C#中的Dictionary:

		local iter = bones:GetEnumerator() --bones为Dictionary

		while iter:MoveNext() do
			local v = iter.Current.Value
			print("key = "..iter.Current.Key);                            
		end

GetEnumerator方法表示获取到该对象的枚举计数器,然后就可以访问到Key,和Value了。

猜你喜欢

转载自blog.csdn.net/iamlegendary/article/details/86491964