test.fl.lua 369 B

12345678910111213141516171819202122
  1. function write_to_log(str)
  2. local fh = io.open('lua_script_log.txt', 'a+')
  3. if fh then
  4. fh:write(str)
  5. fh:close()
  6. end
  7. end
  8. function preprocess_file(fn)
  9. --write_to_log(fn)
  10. local fh = io.open(fn)
  11. if fh then
  12. local fc = fh:read('*a')
  13. fh:close()
  14. fh = io.open(fn, 'w')
  15. if fh then
  16. fh:write('//lua preprocess\n')
  17. fh:write(fc)
  18. fh:close()
  19. end
  20. end
  21. end