mount.lua 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. return {
  2. summary = 'Mount a directory or archive.',
  3. description = [[
  4. Mounts a directory or `.zip` archive, adding it to the virtual filesystem. This
  5. allows you to read files from it.
  6. ]],
  7. arguments = {
  8. {
  9. name = 'path',
  10. type = 'string',
  11. description = 'The path to mount.'
  12. },
  13. {
  14. name = 'mountpoint',
  15. type = 'string',
  16. default = [['/']],
  17. description = 'The path in the virtual filesystem to mount to.'
  18. },
  19. {
  20. name = 'append',
  21. type = 'boolean',
  22. default = 'false',
  23. description = [[
  24. Whether the archive will be added to the end or the beginning of the search path.
  25. ]]
  26. },
  27. {
  28. name = 'root',
  29. type = 'string',
  30. default = 'nil',
  31. description = [[
  32. A subdirectory inside the archive to use as the root. If `nil`, the actual root of the
  33. archive is used.
  34. ]]
  35. }
  36. },
  37. returns = {
  38. {
  39. name = 'success',
  40. type = 'boolean',
  41. description = 'Whether the archive was successfully mounted.'
  42. }
  43. },
  44. notes = [[
  45. The `append` option lets you control the priority of the archive's files in the event of naming
  46. collisions.
  47. This function is not thread safe. Mounting or unmounting an archive while other threads call
  48. lovr.filesystem functions is not supported.
  49. ]],
  50. example = {
  51. description = 'Mount `data.zip` with a file `images/background.png`:',
  52. code = [[
  53. lovr.filesystem.mount('data.zip', 'assets')
  54. print(lovr.filesystem.isFile('assets/images/background.png')) -- true
  55. ]]
  56. },
  57. related = {
  58. 'lovr.filesystem.unmount'
  59. }
  60. }