Advertisement
ecco7777

namen sucher

Dec 12th, 2016
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.82 KB | None | 0 0
  1. function fileToTable(file)
  2. if fs.exists(file)~=true then
  3. print("file"..file.." not found")
  4. return(false)
  5. end
  6. fp=fs.open(file,"r")
  7. line={}
  8. i=1
  9. line[i]=fp.readLine()
  10. if line[i]==nil then return(false) end
  11. while line[i]~=nil do
  12. i=i+1
  13. line[i]=fp.readLine()
  14. end
  15. return(line)
  16. end
  17.  
  18. function listItems()
  19. while string.find(itemsRaw,",") do
  20. items[i]=tonumber(string.sub(itemsRaw,string.find(itemsRaw,"{")+2,string.find(itemsRaw,"]")-1))
  21. itemsRaw="{"..string.sub(itemsRaw,string.find(itemsRaw,",")+1)
  22. i=i+1
  23. end
  24. end
  25.  
  26. namen={}
  27. names=fileToTable("name")
  28. i2=1
  29. for i=1,#names do
  30. if string.sub(names[i],#names[i],#names[i])=="n" and string.find(names[i],"a") and #names[i]==6 then
  31. namen[i2]=names[i]
  32. i2=i2+1
  33. end
  34. end
  35.  
  36. fp=fs.open("namen","a")
  37. for i=1,#namen do
  38. print(namen[i])
  39. fp.writeLine(namen[i])
  40. end
  41. fp.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement