read.lua 705 B

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