[docs/lua-api-mod.md] Documentation improved for 'mod:path()'.

This commit is contained in:
Quentin Bazin 2020-04-29 21:46:19 +02:00
parent 51514bfe79
commit 0a00361f50
4 changed files with 18 additions and 6 deletions

View File

@ -7,7 +7,7 @@ gui:image {
name = "img_background", -- mandatory
pos = {x = 0, y = 0}, -- mandatory
texture = "mods/default/textures/gui/workbench.png",
texture = mod:path() .. "/textures/gui/workbench.png",
clip = {x = 0, y = 0, width = 176, height = 166},
}
```
@ -55,6 +55,8 @@ Full path of the texture. Relative to the repo root.
Example:
```lua
texture = "mods/default/textures/gui/workbench.png"
texture = mod:path() .. "/textures/gui/workbench.png"
```
See [this page](/lua-api-mod#path) for more details about `mod:path()`.

View File

@ -14,7 +14,7 @@ gui:progress_bar {
meta = "item_progress",
max_value = 200,
texture = "mods/default/textures/gui/furnace.png",
texture = mod:path() .. "/textures/gui/furnace.png",
clip = {x = 176, y = 14, width = 24, height = 17},
}
```
@ -101,9 +101,11 @@ Full path of the texture. Relative to the repo root.
Example:
```lua
texture = "mods/default/textures/gui/furnace.png"
texture = mod:path() .. "/textures/gui/furnace.png"
```
See [this page](/lua-api-mod#path) for more details about `mod:path()`.
### `type`
Type of the progress bar.

View File

@ -7,7 +7,7 @@ gui:scroll_bar {
name = "scroll_bar",
pos = {x = 175, y = 18},
texture = "mods/default/textures/gui/tabs.png",
texture = mod:path() .. "/textures/gui/tabs.png",
clip = {x = 232, y = 0, width = 12, height = 15},
widget = "inv_creative_items",
@ -78,9 +78,11 @@ Full path of the texture. Relative to the repo root.
Example:
```lua
texture = "mods/default/textures/gui/tabs.png"
texture = mod:path() .. "/textures/gui/tabs.png"
```
See [this page](/lua-api-mod#path) for more details about `mod:path()`.
### `widget`
Name of the inventory widget which will be affected by the scroll bar.

View File

@ -62,6 +62,12 @@ Returns the string ID of the mod.
Returns the path of the mod, relative to current working directory.
**Note:** In callbacks like `on_block_activated`, the `mod` object may be invalid.
You'll need to create a local variable at the beginning of the file:
```lua
local modpath = mod:path()
```
## Registration functions
### `block`