mount.lua 1.7 KB

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