lua语言怎么逐行读取文件内容并赋值到数组中?
lua吧
全部回复
仅看楼主
level 1
1564311977----123456789
1375021637----123456789
1730287611----123456789
上面的内容是在一个list.txt的文件中。
分隔符前面的内容保存到A数组,分隔符后面的内容保存到B数组。
用LUA 语言来写。
2014年04月28日 08点04分 1
level 10
c={}
A={}
B={}
f = io.open("list.txt",r)
for i in f:lines() do
table.insert(c,i)
end
for i=1,#c do
A[i],B[i] = string.match(c[i], "(%d+)%D+(%d+)")
end
2014年04月29日 13点04分 3
回复 大灬勇ii :去掉什么空格 后面有没有空格
2014年09月18日 08点09分
回复 叶家浪子 :可以的
2014年10月18日 14点10分
怎么读取小数?
2015年11月30日 02点11分
为什么出现英文字符为nil
2016年12月08日 03点12分
level 1
这个函数看不懂
2014年09月15日 02点09分 4
level 11
学习学习!
2014年09月18日 22点09分 5
level 10
14年的贴也跑上来了
 ✎﹏﹏
回复数量:12条
发贴时间:963天2小时54分钟前
2016年12月16日 10点12分 7
1