Skip to content

Commit 594738a

Browse files
committed
Standardised item details docs a little
Sort of closes #2125. I've really struggled to find a way to make it clear that the information returned here is a snapshot of the current item, and not a live view and/or proxy. Most wordings I've tried end up feeling really clunky — given that this is a relatively rare misunderstanding, let's not stress about this too much.
1 parent 27f2ab3 commit 594738a

File tree

4 files changed

+11
-12
lines changed

4 files changed

+11
-12
lines changed

CONTRIBUTING.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@ You'll first need to [set up a development environment as above](#setting-up-a-d
8888

8989
Once this is set up, you can now run `./gradlew docWebsite`. This generates documentation from our Lua and Java code,
9090
writing the resulting HTML into `./projects/web/build/site`, which can then be opened in a browser. When iterating on
91-
documentation, you can instead run `./gradlew docWebsite -t`, which will rebuild documentation every time you change a
92-
file.
91+
documentation, you can instead run `./gradlew :web:assemble -x :web:compileTeaVM -t`, which will rebuild documentation
92+
every time you change a file.
9393

9494
Documentation is built using [illuaminate] which, while not currently documented (somewhat ironic), is largely the same
9595
as [ldoc][ldoc]. Documentation comments are written in Markdown, though note that we do not support many GitHub-specific

projects/common/src/main/java/dan200/computercraft/shared/peripheral/generic/methods/AbstractFluidMethods.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ public final String id() {
4141
* The returned table is sparse, and so empty tanks will be `nil` - it is recommended to loop over using [`pairs`]
4242
* rather than [`ipairs`].
4343
*
44-
* @param fluids The current fluid handler.
44+
* @param fluids The current fluid storage.
4545
* @return All tanks.
46-
* @cc.treturn { (table|nil)... } All tanks in this fluid storage.
46+
* @cc.treturn { (table|nil)... } Basic information about all fluids in this fluid storage.
4747
*/
4848
@LuaFunction(mainThread = true)
4949
public abstract Map<Integer, Map<String, ?>> tanks(T fluids);

projects/common/src/main/java/dan200/computercraft/shared/peripheral/generic/methods/AbstractInventoryMethods.java

+4-5
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ public final String id() {
5656
* rather than [`ipairs`].
5757
*
5858
* @param inventory The current inventory.
59-
* @return All items in this inventory.
60-
* @cc.treturn { (table|nil)... } All items in this inventory.
59+
* @return Basic information about all items in this inventory.
60+
* @cc.treturn { (table|nil)... } Basic information about all items in this inventory.
6161
* @cc.usage Find an adjacent chest and print all items in it.
6262
*
6363
* <pre>{@code
@@ -89,9 +89,8 @@ public final String id() {
8989
*
9090
* @param inventory The current inventory.
9191
* @param slot The slot to get information about.
92-
* @return Information about the item in this slot, or {@code nil} if not present.
92+
* @return Information about the item in this slot, or {@code nil} if it is empty.
9393
* @throws LuaException If the slot is out of range.
94-
* @cc.treturn table Information about the item in this slot, or {@code nil} if not present.
9594
* @cc.usage Print some information about the first in a chest.
9695
*
9796
* <pre>{@code
@@ -109,7 +108,7 @@ public final String id() {
109108
*/
110109
@Nullable
111110
@LuaFunction(mainThread = true)
112-
public abstract Map<String, ?> getItemDetail(T inventory, int slot) throws LuaException;
111+
public abstract Map<?, ?> getItemDetail(T inventory, int slot) throws LuaException;
113112

114113
/**
115114
* Get the maximum number of items which can be stored in this slot.

projects/common/src/main/java/dan200/computercraft/shared/turtle/apis/TurtleAPI.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -694,7 +694,7 @@ public final MethodResult equipRight() {
694694
* This returns information about the currently equipped item, in the same form as
695695
* {@link #getItemDetail(ILuaContext, Optional, Optional)}.
696696
*
697-
* @return Details about the currently equipped item, or {@code nil} if no upgrade is equipped.
697+
* @return Information about the currently equipped item, or {@code nil} if no upgrade is equipped.
698698
* @see #equipLeft()
699699
* @cc.since 1.116.0
700700
*/
@@ -710,7 +710,7 @@ public final MethodResult equipRight() {
710710
* This returns information about the currently equipped item, in the same form as
711711
* {@link #getItemDetail(ILuaContext, Optional, Optional)}.
712712
*
713-
* @return Details about the currently equipped item, or {@code nil} if no upgrade is equipped.
713+
* @return Information about the currently equipped item, or {@code nil} if no upgrade is equipped.
714714
* @see #equipRight()
715715
* @cc.since 1.116.0
716716
*/
@@ -781,7 +781,7 @@ public final MethodResult inspectDown() {
781781
* more information about the item at the cost of taking longer to run.
782782
* @return The command result.
783783
* @throws LuaException If the slot is out of range.
784-
* @cc.treturn nil|table Information about the given slot, or {@code nil} if it is empty.
784+
* @cc.treturn nil|table Information about the item in this slot, or {@code nil} if it is empty.
785785
* @cc.since 1.64
786786
* @cc.changed 1.90.0 Added detailed parameter.
787787
* @cc.usage Print the current slot, assuming it contains 13 dirt.

0 commit comments

Comments
 (0)