diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2023-03-06 20:58:43 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2023-03-06 20:58:43 +0800 |
commit | 8620b4a056275643f15c7c8053e8e4af807ac3dc (patch) | |
tree | 955afc2c84aa5e8874bf6717e4362e015a62d04b /meta | |
parent | 3c994c639b87febc8aa515bea145e32338e658a9 (diff) | |
download | lua-language-server-8620b4a056275643f15c7c8053e8e4af807ac3dc.zip |
update lovr-api
Diffstat (limited to 'meta')
-rw-r--r-- | meta/3rd/lovr/library/lovr/filesystem.lua | 32 | ||||
-rw-r--r-- | meta/3rd/lovr/library/lovr/graphics.lua | 9 |
2 files changed, 28 insertions, 13 deletions
diff --git a/meta/3rd/lovr/library/lovr/filesystem.lua b/meta/3rd/lovr/library/lovr/filesystem.lua index ff6f2ad9..c2a1220b 100644 --- a/meta/3rd/lovr/library/lovr/filesystem.lua +++ b/meta/3rd/lovr/library/lovr/filesystem.lua @@ -3,9 +3,7 @@ --- ---The `lovr.filesystem` module provides access to the filesystem. --- ---- ----### NOTE: ----LÖVR programs can only write to a single directory, called the save directory. +---All files written will go in a special folder called the "save directory". --- ---The location of the save directory is platform-specific: --- @@ -27,15 +25,25 @@ --- <td><code>/sdcard/Android/data/<identity>/files</code></td> --- </tr> </table> --- ----`<identity>` should be a unique identifier for your app. +---`<identity>` is a unique identifier for the project, and can be set in `lovr.conf`. +--- +---On Android, the identity can not be changed and will always be the package id (e.g. `org.lovr.app`). +--- +---When files are read, they will be searched for in multiple places. +--- +---By default, the save directory is checked first, then the project source (folder or zip). --- ----It can be set either in `lovr.conf` or by using `lovr.filesystem.setIdentity`. +---That way, when data is written to a file, any future reads will see the new data. --- ----On Android, the identity can not be changed and will always be the package id, like `org.lovr.app`. +---The `t.saveprecedence` conf setting can be used to change this precedence. --- ----All filenames are relative to either the save directory or the directory containing the project source. +---Conceptually, `lovr.filesystem` uses a "virtual filesystem", which is an ordered list of folders and zip files that are merged into a single filesystem hierarchy. --- ----Files in the save directory take precedence over files in the project. +---Folders and archives in the list can be added and removed with `lovr.filesystem.mount` and `lovr.filesystem.unmount`. +--- +---LÖVR extends Lua's `require` function to look for modules in the virtual filesystem. +--- +---The search patterns can be changed with `lovr.filesystem.setRequirePath`, similar to `package.path`. --- ---@class lovr.filesystem lovr.filesystem = {} @@ -283,7 +291,7 @@ function lovr.filesystem.setIdentity(identity) end --- ---Any question marks in the pattern will be replaced with the module that is being required. --- ----It is similar to Lua\'s `package.path` variable, but the main difference is that the patterns are relative to the save directory and the project directory. +---It is similar to Lua\'s `package.path` variable, except the patterns will be checked using `lovr.filesystem` APIs. This allows `require` to work even when the project is packaged into a zip archive, or when the project is launched from a different directory. --- --- ---### NOTE: @@ -306,7 +314,7 @@ function lovr.filesystem.setRequirePath(path) end function lovr.filesystem.unmount(path) end --- ----Write to a file. +---Write to a file in the save directory. --- --- ---### NOTE: @@ -314,6 +322,10 @@ function lovr.filesystem.unmount(path) end --- ---If the file already has data in it, it will be replaced with the new content. --- +---If the path contains subdirectories, all of the parent directories need to exist first or the write will fail. +--- +---Use `lovr.filesystem.createDirectory` to make sure they're created first. +--- ---@overload fun(filename: string, blob: lovr.Blob):boolean ---@param filename string # The file to write to. ---@param content string # A string to write to the file. diff --git a/meta/3rd/lovr/library/lovr/graphics.lua b/meta/3rd/lovr/library/lovr/graphics.lua index 36045f00..8157bdb2 100644 --- a/meta/3rd/lovr/library/lovr/graphics.lua +++ b/meta/3rd/lovr/library/lovr/graphics.lua @@ -526,8 +526,8 @@ function lovr.graphics.newTally(type, count, views) end ---### NOTE: ---If no `type` is provided in the options table, LÖVR will guess the `TextureType` of the Texture based on the number of layers: --- ----- If there's 1 layer, the type will be `2d`. ----- If there are 6 layers, the type will be `cube`. +---- If there's only 1 layer, the type will be `2d`. +---- If there are 6 images provided, the type will be `cube`. ---- Otherwise, the type will be `array`. --- ---Note that an Image can contain multiple layers and mipmaps. @@ -1534,7 +1534,9 @@ function Pass:capsule(transform, segments) end --- --- ---### NOTE: ----The local origin of the circle is in its center, and the local z axis goes through the center. +---The local origin of the circle is in its center. +--- +---The local z axis is perpendicular to plane of the circle. --- ---@param transform lovr.Mat4 # The transform of the circle. Can also be provided as position, radius, and rotation, using a mix of `Vectors` or numbers. ---@param style? lovr.DrawStyle # Whether the circle should be filled or outlined. @@ -1987,6 +1989,7 @@ function Pass:setAlphaToCoverage(enable) end ---### NOTE: ---The default blend mode is `alpha` with the `alphamultiply` alpha mode. --- +---@overload fun(self: lovr.Pass) ---@param blend lovr.BlendMode # The blend mode. ---@param alphaBlend lovr.BlendAlphaMode # The alpha blend mode, used to control premultiplied alpha. function Pass:setBlendMode(blend, alphaBlend) end |