Skip to content

Commit

Permalink
Create 逐行读取文件内容.lua
Browse files Browse the repository at this point in the history
  • Loading branch information
chudongjingling authored Jun 3, 2020
1 parent 88a8b89 commit 53850e0
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions 桃子的示例代码/逐行读取文件内容.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
------------------------------------- 读取账号
local Users ={} --初始化账号表
file = io.open("/User/Media/TouchSprite/wenben/test.txt","r") --打开文件流
for line in file:lines() do --一行一行读取
string.match(table.insert(Users,line),'%C+')
end
file:close() --关闭文件流
-------------------------------------


------------------------------------- 登陆部分
function Login(User,Pass)
--User是账号
--Pass是密码
--inputText即可

end
-------------------------------------

------------------------------------- 循环账号表
for UserPass in ipairs(Users) do --以Table 遍历账号表
local User, Pass = string.match(UserPass, "([^-]*)[-]*([^-]*)[-]*([^-]*)[-]*([^%c-]*)[-]*") --拆分账号密码
Login(User, Pass) --调用登陆函数
end
-------------------------------------

0 comments on commit 53850e0

Please sign in to comment.