Advertisement
Marlingaming

settings Manager

May 6th, 2022
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. function get(item)
  2. local file = io.open("os/settings.txt","r")
  3. local Content
  4. repeat
  5. Content = {file.readLine()}
  6. until Content[1] == item
  7. file.close()
  8. return(Content[2])
  9. end
  10.  
  11. function set(item,var)
  12. local file = io.open("os/settings.txt","r")
  13. local Text = {file.readAll()}
  14. file.close()
  15. local Doc = io.open("os/settings.txt","w")
  16. local Content
  17. for i = 1, #Text do
  18. Content = Text[i]
  19. if Content[1] == item then Text[i][2] = var end
  20. end
  21. Doc.write(Text)
  22. Doc.close()
  23. return true
  24. end
  25.  
  26. function add(item,var)
  27. local file = io.open("os/settings.txt","a")
  28. file.writeLine({item,var})
  29. file.close()
  30. return true
  31. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement