您的位置:首页 > 编程语言 > Lua

Example for lua table

2015-01-04 10:21 281 查看
a = {}
for i=1, 10 do
local sql = string.format("%d %s", i, os.date("%Y-%m-%d %H:%M:%S")) -- to_date('%s','yyyy-mm-dd hh24:mi:ss')  2015-01-04 10:09:38	a[i] = sql
a.size = i  -- the record of the table size
end

if type(a) == 'table' then
for i=1, #a do
print(a.i)  -- nil
print(a[i]) -- i 2015-01-04 10:09:38
end
end


 


 
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  lua