read.lua 792 B

123456789101112131415161718192021222324252627282930313233
  1. return {
  2. tag = 'filesystem-files',
  3. summary = 'Read a file.',
  4. description = 'Read the contents of a file.',
  5. arguments = {
  6. filename = {
  7. type = 'string',
  8. description = 'The name of the file to read.'
  9. },
  10. bytes = {
  11. type = 'number',
  12. default = '-1',
  13. description = 'The number of bytes to read (if -1, all bytes will be read).'
  14. }
  15. },
  16. returns = {
  17. contents = {
  18. type = 'string',
  19. description = 'The contents of the file.'
  20. },
  21. bytes = {
  22. type = 'number',
  23. description = 'The number of bytes read from the file.'
  24. }
  25. },
  26. variants = {
  27. {
  28. arguments = { 'filename', 'bytes' },
  29. returns = { 'contents', 'bytes' }
  30. }
  31. },
  32. notes = 'If the file does not exist or cannot be read, nil is returned.'
  33. }