write.lua 922 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. return {
  2. summary = 'Write to a file.',
  3. description = 'Write to a file.',
  4. arguments = {
  5. filename = {
  6. type = 'string',
  7. description = 'The file to write to.'
  8. },
  9. content = {
  10. type = 'string',
  11. description = 'A string to write to the file.'
  12. },
  13. blob = {
  14. type = 'Blob',
  15. description = 'A Blob containing data to write to the file.'
  16. }
  17. },
  18. returns = {
  19. bytes = {
  20. type = 'number',
  21. description = 'The number of bytes written.'
  22. }
  23. },
  24. variants = {
  25. {
  26. arguments = { 'filename', 'content' },
  27. returns = { 'bytes' }
  28. },
  29. {
  30. arguments = { 'filename', 'blob' },
  31. returns = { 'bytes' }
  32. }
  33. },
  34. notes = [[
  35. If the file does not exist, it is created.
  36. If the file already has data in it, it will be replaced with the new content.
  37. ]],
  38. related = {
  39. 'lovr.filesystem.append',
  40. 'lovr.filesystem.read'
  41. }
  42. }