Advertisement
MrSlimbrowser

LuaTextFile.lua

Apr 16th, 2020
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. function Initialize()
  2.  
  3. sFileToRead = SELF:GetOption('FileToRead')
  4.  
  5. end
  6.  
  7. function Update()
  8.  
  9. hReadingFile = io.open(sFileToRead)
  10. if not hReadingFile then
  11. print('LuaTextFile: unable to open file at ' .. sFileToRead)
  12. return
  13. end
  14.  
  15. sAllText = hReadingFile:read("*all")
  16.  
  17. sAllText = string.gsub(sAllText, "\t", " ")
  18. sAllText = string.gsub(sAllText, "#\n", "---------------------------------------------\n")
  19.  
  20. io.close(hReadingFile)
  21.  
  22. return tostring(sAllText)
  23.  
  24. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement