摘要: Lua中的table不是一种简单的数据结构,它可以作为其它数据结构的基础。如数组、记录、线性表、队列和集合等,在Lua中都可以通过table来表示。 1. 数组: 使用整数来索引table即可在Lua中实现数组。因此,Lua中的数组没有固定的大小,如:1 a = {}2 for i = 1, 1000 do3 a[i] = 04 end5 print("The length of array 'a' is " .. #a)6 --The length of array 'a' is 1000 在Lua中,可以让任何数作为数组的起始索引,但通常 阅读全文
posted @ 2012-06-25 10:28 OrangeAdmin 阅读(11785) 评论(3) 推荐(3) 编辑