mirror of
https://github.com/d0k3/GodMode9.git
synced 2025-06-25 21:22:47 +00:00
Lua documentation fixes (#910)
* lua-doc: Fix fs.find_all documentation It returns an array, not a string. Also document return information. * lua-doc: Remove TODO for fs.verify_with_sha_file No reason to add fs.read_file errors here as that function gets pcall-ed. If it fails, nil gets returned. * lua-doc: Consistently refer to tables/arrays as tables That's what they're called within Lua all the time. * lua-doc: fix incorrect references to util module
This commit is contained in:
parent
99f1abd7a4
commit
9ae4351bce
@ -111,9 +111,9 @@ EMUID0 | sys.emu_id0 |
|
|||||||
EMUBASE | sys.emu_base |
|
EMUBASE | sys.emu_base |
|
||||||
SERIAL | sys.serial |
|
SERIAL | sys.serial |
|
||||||
REGION | sys.region |
|
REGION | sys.region |
|
||||||
SDSIZE | fs.stat_fs("0:/").total | int instead of string (use util.format_bytes to format it)
|
SDSIZE | fs.stat_fs("0:/").total | int instead of string (use ui.format_bytes to format it)
|
||||||
SDFREE | fs.stat_fs("0:/").free | int instead of string (use util.format_bytes to format it)
|
SDFREE | fs.stat_fs("0:/").free | int instead of string (use ui.format_bytes to format it)
|
||||||
NANDSIZE | NANDSIZE | int instead of string (use util.format_bytes to format it)
|
NANDSIZE | NANDSIZE | int instead of string (use ui.format_bytes to format it)
|
||||||
GM9OUT | GM9OUT |
|
GM9OUT | GM9OUT |
|
||||||
CURRDIR | CURRDIR | nil instead of “(null)" if it can’t be found
|
CURRDIR | CURRDIR | nil instead of “(null)" if it can’t be found
|
||||||
ONTYPE | CONSOLE_TYPE | “O3DS" or “N3DS"
|
ONTYPE | CONSOLE_TYPE | “O3DS" or “N3DS"
|
||||||
@ -251,7 +251,7 @@ Ask the user to input text.
|
|||||||
|
|
||||||
#### ui.ask_selection
|
#### ui.ask_selection
|
||||||
|
|
||||||
* `int ui.ask_selection(string prompt, array options)`
|
* `int ui.ask_selection(string prompt, table options)`
|
||||||
|
|
||||||
Ask the user to choose an option from a list. A maximum of 256 options are allowed.
|
Ask the user to choose an option from a list. A maximum of 256 options are allowed.
|
||||||
|
|
||||||
@ -437,7 +437,7 @@ Create a directory. This creates intermediate directories as required, so `fs.mk
|
|||||||
|
|
||||||
#### fs.stat
|
#### fs.stat
|
||||||
|
|
||||||
* `array fs.stat(string path)`
|
* `table fs.stat(string path)`
|
||||||
|
|
||||||
Get information about a file or directory. The result is a stat table with these keys:
|
Get information about a file or directory. The result is a stat table with these keys:
|
||||||
|
|
||||||
@ -453,7 +453,7 @@ Get information about a file or directory. The result is a stat table with these
|
|||||||
|
|
||||||
#### fs.list_dir
|
#### fs.list_dir
|
||||||
|
|
||||||
* `array fs.list_dir(string path)`
|
* `table fs.list_dir(string path)`
|
||||||
|
|
||||||
Get the contents of a directory. The result is a list of stat tables with these keys:
|
Get the contents of a directory. The result is a list of stat tables with these keys:
|
||||||
* `name` (string)
|
* `name` (string)
|
||||||
@ -474,7 +474,7 @@ Get the contents of a directory. The result is a list of stat tables with these
|
|||||||
|
|
||||||
#### fs.stat_fs
|
#### fs.stat_fs
|
||||||
|
|
||||||
* `array fs.stat_fs(string path)`
|
* `table fs.stat_fs(string path)`
|
||||||
|
|
||||||
Get information about a filesystem.
|
Get information about a filesystem.
|
||||||
|
|
||||||
@ -490,7 +490,7 @@ Get information about a filesystem.
|
|||||||
|
|
||||||
#### fs.dir_info
|
#### fs.dir_info
|
||||||
|
|
||||||
* `array fs.dir_info(string path)`
|
* `table fs.dir_info(string path)`
|
||||||
|
|
||||||
Get information about a directory.
|
Get information about a directory.
|
||||||
|
|
||||||
@ -570,7 +570,7 @@ Pattern can use `?` for search values, for example `nand_??.bin` will check to s
|
|||||||
|
|
||||||
#### fs.find_all
|
#### fs.find_all
|
||||||
|
|
||||||
* `string fs.find_all(string dir, string pattern[, table opts {bool recursive}])`
|
* `table fs.find_all(string dir, string pattern[, table opts {bool recursive}])`
|
||||||
|
|
||||||
Search for all files that match a pattern.
|
Search for all files that match a pattern.
|
||||||
* **Arguments**
|
* **Arguments**
|
||||||
@ -578,6 +578,7 @@ Search for all files that match a pattern.
|
|||||||
* `pattern` - Filename pattern
|
* `pattern` - Filename pattern
|
||||||
* `opts` (optional) - Option flags
|
* `opts` (optional) - Option flags
|
||||||
* `recursive` - Remove directories recursively
|
* `recursive` - Remove directories recursively
|
||||||
|
* **Returns:** table of found files
|
||||||
* **Throws**
|
* **Throws**
|
||||||
* `"could not open directory"` - failed to open directory
|
* `"could not open directory"` - failed to open directory
|
||||||
|
|
||||||
@ -679,8 +680,6 @@ Calculate the hash of a file and compare it with a corresponding `.sha` file.
|
|||||||
> [!IMPORTANT]
|
> [!IMPORTANT]
|
||||||
> This currently assumes SHA-256. In the future this may automatically use SHA-1 when appropriate, based on the `.sha` file size.
|
> This currently assumes SHA-256. In the future this may automatically use SHA-1 when appropriate, based on the `.sha` file size.
|
||||||
|
|
||||||
TODO: add errors for fs.read_file here
|
|
||||||
|
|
||||||
* **Argumens**
|
* **Argumens**
|
||||||
* `path` - File to hash
|
* `path` - File to hash
|
||||||
* **Returns:** `true` if successful, `false` if failed, `nil` if `.sha` file could not be read
|
* **Returns:** `true` if successful, `false` if failed, `nil` if `.sha` file could not be read
|
||||||
|
Loading…
x
Reference in New Issue
Block a user