xlua中的ipairs和pairs

  在xlua中,已经为IEnumerable对象实现了__pairs方法。所以在lua中可以for _, xxxx in pairs()来使用。

  如遍历子结点:for i, childTransform in pairs(parentTransform) do ... end。这里需要注意的是i是从0开始的,并不是1。

  pairs同样适用于其它类,如Animation中用于查找AnimationState。

  经测试用ipairs并不会报错,但并不会有执行结果,所以不可用。

原文地址:https://www.cnblogs.com/hghhe/p/12204953.html