init.lua 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. return {
  2. tag = 'modules',
  3. summary = 'Provides access to the filesystem.',
  4. description = [[
  5. The `lovr.filesystem` module provides access to the filesystem.
  6. All files written will go in a special folder called the "save directory". The location of the
  7. save directory is platform-specific:
  8. <table>
  9. <tr>
  10. <td>Windows</td>
  11. <td><code>C:\Users\&lt;user&gt;\AppData\Roaming\LOVR\&lt;identity&gt;</code></td>
  12. </tr>
  13. <tr>
  14. <td>macOS</td>
  15. <td><code>/Users/&lt;user&gt;/Library/Application Support/LOVR/&lt;identity&gt;</code></td>
  16. </tr>
  17. <tr>
  18. <td>Linux</td>
  19. <td><code>/home/&lt;user&gt;/.local/share/LOVR/&lt;identity&gt;</code></td>
  20. </tr>
  21. <tr>
  22. <td>Android</td>
  23. <td><code>/sdcard/Android/data/&lt;identity&gt;/files</code></td>
  24. </tr>
  25. </table>
  26. `<identity>` is a unique identifier for the project, and can be set in `lovr.conf`. On Android,
  27. the identity can not be changed and will always be the package id (e.g. `org.lovr.app`).
  28. When files are read, they will be searched for in multiple places. By default, the save
  29. directory is checked first, then the project source (folder or zip). That way, when data is
  30. written to a file, any future reads will see the new data. The `t.saveprecedence` conf setting
  31. can be used to change this precedence.
  32. Conceptually, `lovr.filesystem` uses a "virtual filesystem", which is an ordered list of folders
  33. and zip files that are merged into a single filesystem hierarchy. Folders and archives in the
  34. list can be added and removed with `lovr.filesystem.mount` and `lovr.filesystem.unmount`.
  35. LÖVR extends Lua's `require` function to look for modules in the virtual filesystem. The search
  36. patterns can be changed with `lovr.filesystem.setRequirePath`, similar to `package.path`.
  37. ]],
  38. sections = {
  39. {
  40. name = 'Files',
  41. tag = 'filesystem-files',
  42. description = 'Operations for reading/writing files and querying their metadata.'
  43. },
  44. {
  45. name = 'Virtual Filesystem',
  46. tag = 'filesystem-virtual'
  47. },
  48. {
  49. name = 'Paths',
  50. tag = 'filesystem-paths',
  51. description = 'Useful system paths.'
  52. },
  53. {
  54. name = 'Lua',
  55. tag = 'filesystem-lua'
  56. }
  57. }
  58. }