lua manual adapted, bugfix in core function

This commit is contained in:
Joachim Stolberg 2020-08-02 22:06:55 +02:00
parent 7f4a35950c
commit 96b227da2d
3 changed files with 22 additions and 15 deletions

View File

@ -219,7 +219,7 @@ end
function techage.remove_node(pos, oldnode, oldmetadata) function techage.remove_node(pos, oldnode, oldmetadata)
local number = oldmetadata and oldmetadata.fields and oldmetadata.fields.node_number local number = oldmetadata and oldmetadata.fields and oldmetadata.fields.node_number
number = number or get_number(pos) number = number or get_number(pos)
if number then if number and tonumber(number) then
local key = minetest.hash_node_position(pos) local key = minetest.hash_node_position(pos)
NumbersToBeRecycled[key] = number NumbersToBeRecycled[key] = number
local ninfo = NodeInfoCache[number] or update_nodeinfo(number) local ninfo = NodeInfoCache[number] or update_nodeinfo(number)

View File

@ -351,7 +351,7 @@ In addition to Lua standard function the Lua Controller provides the following f
The result is block dependent (see table below): The result is block dependent (see table below):
| ident | returned data | comment | | ident | returned data | comment |
| ----------- | ------------------------------------------------------------ | ------------------------------------------------------------ | | ------------ | ------------------------------------------------------------ | ------------------------------------------------------------ |
| "state" | one of: "running", "stopped", "blocked", "standby", "fault", or "unloaded" | Techage machine state, used by many machines | | "state" | one of: "running", "stopped", "blocked", "standby", "fault", or "unloaded" | Techage machine state, used by many machines |
| "state" | one of: "red", "amber", "green", "off" | Signal Tower state | | "state" | one of: "red", "amber", "green", "off" | Signal Tower state |
| "state" | one of: "empty", "loaded", "full" | State of a chest or Sensor Chest | | "state" | one of: "empty", "loaded", "full" | State of a chest or Sensor Chest |
@ -363,6 +363,7 @@ In addition to Lua standard function the Lua Controller provides the following f
| "stacks" | Array with up to 4 Stores with the inventory content (see example) | only for Sensor Chests | | "stacks" | Array with up to 4 Stores with the inventory content (see example) | only for Sensor Chests |
| "count" | number | Read the item counter of the TA4 Item Detector block | | "count" | number | Read the item counter of the TA4 Item Detector block |
| "count" | number of items | Read the total amount of TA4 chest items. An optional number as `add_data` is used to address only on inventory slot (1..8, from left to right). | | "count" | number of items | Read the total amount of TA4 chest items. An optional number as `add_data` is used to address only on inventory slot (1..8, from left to right). |
| "itemstring" | item string of the given slot | Specific command for the TA4 8x2000 Chest to read the item type (technical name) of one chest slot, specified via `add_data` (1..8).<br />Example: s = $read_data("223", "itemstring", 1) |
@ -410,10 +411,16 @@ Messages are used to transport data between Controllers. Messages are text strin
* `$chat(text)` - Send yourself a chat message. _text_ is a text string. * `$chat(text)` - Send yourself a chat message. _text_ is a text string.
* `$door(pos, text)` - Open/Close a door at position "pos". * `$door(pos, text)` - Open/Close a door at position "pos".
Example: `$door("123,7,-1200", "close")`. Example: `$door("123,7,-1200", "close")`.
Hint: Use the Techage Info Tool to determine the door position. Hint: Use the Techage Info Tool to determine the door position.
* `$item_description("default:apple")`
Get the description (item name) for a specified itemstring, e. g. determined via the TA4 8x2000 Chest command `itemstring`:
`str = $read_data("223", "itemstring", 1)`
`descr = $item_description(str)`
## Example Scripts ## Example Scripts

Binary file not shown.