mirror of
				https://github.com/SquidDev-CC/CC-Tweaked
				synced 2025-10-31 05:33:00 +00:00 
			
		
		
		
	A couple of documentation improvements
- Add some missing to the turtle API docs - Version history for peripheral and redstone. I /think/ this is complete.
This commit is contained in:
		| @@ -72,6 +72,7 @@ public class RedstoneAPI implements ILuaAPI | |||||||
|      * "back". |      * "back". | ||||||
|      * |      * | ||||||
|      * @return A table of valid sides. |      * @return A table of valid sides. | ||||||
|  |      * @cc.since 1.2 | ||||||
|      */ |      */ | ||||||
|     @LuaFunction |     @LuaFunction | ||||||
|     public final String[] getSides() |     public final String[] getSides() | ||||||
| @@ -122,6 +123,7 @@ public class RedstoneAPI implements ILuaAPI | |||||||
|      * @param side  The side to set. |      * @param side  The side to set. | ||||||
|      * @param value The signal strength between 0 and 15. |      * @param value The signal strength between 0 and 15. | ||||||
|      * @throws LuaException If {@code value} is not betwene 0 and 15. |      * @throws LuaException If {@code value} is not betwene 0 and 15. | ||||||
|  |      * @cc.since 1.51 | ||||||
|      */ |      */ | ||||||
|     @LuaFunction( { "setAnalogOutput", "setAnalogueOutput" } ) |     @LuaFunction( { "setAnalogOutput", "setAnalogueOutput" } ) | ||||||
|     public final void setAnalogOutput( ComputerSide side, int value ) throws LuaException |     public final void setAnalogOutput( ComputerSide side, int value ) throws LuaException | ||||||
| @@ -136,6 +138,7 @@ public class RedstoneAPI implements ILuaAPI | |||||||
|      * @param side The side to get. |      * @param side The side to get. | ||||||
|      * @return The output signal strength, between 0 and 15. |      * @return The output signal strength, between 0 and 15. | ||||||
|      * @see #setAnalogOutput |      * @see #setAnalogOutput | ||||||
|  |      * @cc.since 1.51 | ||||||
|      */ |      */ | ||||||
|     @LuaFunction( { "getAnalogOutput", "getAnalogueOutput" } ) |     @LuaFunction( { "getAnalogOutput", "getAnalogueOutput" } ) | ||||||
|     public final int getAnalogOutput( ComputerSide side ) |     public final int getAnalogOutput( ComputerSide side ) | ||||||
| @@ -148,6 +151,7 @@ public class RedstoneAPI implements ILuaAPI | |||||||
|      * |      * | ||||||
|      * @param side The side to get. |      * @param side The side to get. | ||||||
|      * @return The input signal strength, between 0 and 15. |      * @return The input signal strength, between 0 and 15. | ||||||
|  |      * @cc.since 1.51 | ||||||
|      */ |      */ | ||||||
|     @LuaFunction( { "getAnalogInput", "getAnalogueInput" } ) |     @LuaFunction( { "getAnalogInput", "getAnalogueInput" } ) | ||||||
|     public final int getAnalogInput( ComputerSide side ) |     public final int getAnalogInput( ComputerSide side ) | ||||||
|   | |||||||
| @@ -515,8 +515,8 @@ public class TurtleAPI implements ILuaAPI | |||||||
|     /** |     /** | ||||||
|      * Refuel this turtle. |      * Refuel this turtle. | ||||||
|      * |      * | ||||||
|      * While most actions a turtle can perform (such as digging or placing blocks), moving consumes fuel from the |      * While most actions a turtle can perform (such as digging or placing blocks) are free, moving consumes fuel from | ||||||
|      * turtle's internal buffer. If a turtle has no fuel, it will not move. |      * the turtle's internal buffer. If a turtle has no fuel, it will not move. | ||||||
|      * |      * | ||||||
|      * {@link #refuel} refuels the turtle, consuming fuel items (such as coal or lava buckets) from the currently |      * {@link #refuel} refuels the turtle, consuming fuel items (such as coal or lava buckets) from the currently | ||||||
|      * selected slot and converting them into energy. This finishes once the turtle is fully refuelled or all items have |      * selected slot and converting them into energy. This finishes once the turtle is fully refuelled or all items have | ||||||
|   | |||||||
| @@ -11,6 +11,8 @@ | |||||||
| -- Peripheral functions are called *methods*, a term borrowed from Java. | -- Peripheral functions are called *methods*, a term borrowed from Java. | ||||||
| -- | -- | ||||||
| -- @module peripheral | -- @module peripheral | ||||||
|  | -- @since 1.3 | ||||||
|  | -- @changed 1.51 Add support for wired modems. | ||||||
|  |  | ||||||
| local expect = dofile("rom/modules/main/cc/expect.lua").expect | local expect = dofile("rom/modules/main/cc/expect.lua").expect | ||||||
|  |  | ||||||
| @@ -24,6 +26,7 @@ local sides = rs.getSides() | |||||||
| -- Modem, then it'll be reported according to its name on the wired network. | -- Modem, then it'll be reported according to its name on the wired network. | ||||||
| -- | -- | ||||||
| -- @treturn { string... } A list of the names of all attached peripherals. | -- @treturn { string... } A list of the names of all attached peripherals. | ||||||
|  | -- @since 1.51 | ||||||
| function getNames() | function getNames() | ||||||
|     local results = {} |     local results = {} | ||||||
|     for n = 1, #sides do |     for n = 1, #sides do | ||||||
| @@ -69,6 +72,7 @@ end | |||||||
| -- @tparam string|table peripheral The name of the peripheral to find, or a | -- @tparam string|table peripheral The name of the peripheral to find, or a | ||||||
| -- wrapped peripheral instance. | -- wrapped peripheral instance. | ||||||
| -- @treturn string|nil The peripheral's type, or `nil` if it is not present. | -- @treturn string|nil The peripheral's type, or `nil` if it is not present. | ||||||
|  | -- @changed 1.88.0 Accepts a wrapped peripheral as an argument. | ||||||
| function getType(peripheral) | function getType(peripheral) | ||||||
|     expect(1, peripheral, "string", "table") |     expect(1, peripheral, "string", "table") | ||||||
|     if type(peripheral) == "string" then -- Peripheral name passed |     if type(peripheral) == "string" then -- Peripheral name passed | ||||||
| @@ -118,6 +122,7 @@ end | |||||||
| -- | -- | ||||||
| -- @tparam table peripheral The peripheral to get the name of. | -- @tparam table peripheral The peripheral to get the name of. | ||||||
| -- @treturn string The name of the given peripheral. | -- @treturn string The name of the given peripheral. | ||||||
|  | -- @since 1.88.0 | ||||||
| function getName(peripheral) | function getName(peripheral) | ||||||
|     expect(1, peripheral, "table") |     expect(1, peripheral, "table") | ||||||
|     local mt = getmetatable(peripheral) |     local mt = getmetatable(peripheral) | ||||||
| @@ -209,6 +214,7 @@ and returns if it should be included in the result. | |||||||
| @usage This abuses the `filter` argument to call @{rednet.open} on every modem. | @usage This abuses the `filter` argument to call @{rednet.open} on every modem. | ||||||
|  |  | ||||||
|     peripheral.find("modem", rednet.open) |     peripheral.find("modem", rednet.open) | ||||||
|  | @since 1.6 | ||||||
| ]] | ]] | ||||||
| function find(ty, filter) | function find(ty, filter) | ||||||
|     expect(1, ty, "string") |     expect(1, ty, "string") | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Jonathan Coates
					Jonathan Coates