From 0f15cf4e07f71402678fa450e80076cb223cc374 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Wed, 28 Dec 2016 15:42:04 +0100 Subject: =?UTF-8?q?new=5Fentry/new=5Fcategory=20=E2=86=92=20add=5Fentry/ad?= =?UTF-8?q?d=5Fcategory?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- API.md | 14 +++++++------- init.lua | 6 +++--- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/API.md b/API.md index 02a4ef2..da0e84f 100644 --- a/API.md +++ b/API.md @@ -67,7 +67,7 @@ this block as possible. This is a list of all publicly available functions. ### Overview -The most important functions are `doc.new_category` and `doc.new_entry`. All other functions +The most important functions are `doc.add_category` and `doc.ad_entry`. All other functions are mostly used for utility and examination purposes. If not mentioned otherwise, the return value of all functions is `nil`. @@ -75,8 +75,8 @@ If not mentioned otherwise, the return value of all functions is `nil`. These functions are available: #### Core -* `doc.new_category`: Adds a new category -* `doc.new_entry`: Adds a new entry +* `doc.add_category`: Adds a new category +* `doc.add_entry`: Adds a new entry #### Display * `doc.show_entry`: Shows a particular entry to a player @@ -115,7 +115,7 @@ widget providing an image gallery. -### `doc.new_category(id, def)` +### `doc.add_category(id, def)` Adds a new category. You have to define an unique identifier, a name and a template function to build the entry formspec from the entry data. @@ -206,7 +206,7 @@ the standard function `minetest.register_on_player_receive_fields` to register your event handling. The `formname` parameter will be `doc:entry`. Use `doc.get_selection` to get the category ID and entry ID of the entry in question. -### `doc.new_entry(category_id, entry_id, def)` +### `doc.add_entry(category_id, entry_id, def)` Adds a new entry into an existing category. You have to define the category to which to insert the entry, the entry's identifier, a name and some data which defines the entry. Note you do not directly define here how the @@ -279,7 +279,7 @@ Returns the definition of the specified category. #### Return value The category's definition table as specified in the `def` argument of -`doc.new_category`. The table fields are the same. +`doc.add_category`. The table fields are the same. ### `doc.get_entry_definition(category_id, entry_id)` Returns the definition of the specified entry. @@ -290,7 +290,7 @@ Returns the definition of the specified entry. #### Return value The entry's definition table as specified in the `def` argument of -`doc.new_entry`. The table fields are the same. +`doc.add_entry`. The table fields are the same. ### `doc.entry_exists(category_id, entry_id)` Checks whether the specified entry exists and returns `true` or `false`. diff --git a/init.lua b/init.lua index 2868ea6..75c4191 100644 --- a/init.lua +++ b/init.lua @@ -76,7 +76,7 @@ local set_category_order_was_called = false --[[ Core API functions ]] -- Add a new category -function doc.new_category(id, def) +function doc.add_category(id, def) if doc.data.categories[id] == nil and id ~= nil then doc.data.categories[id] = {} doc.data.categories[id].entries = {} @@ -106,7 +106,7 @@ function doc.new_category(id, def) end -- Add a new entry -function doc.new_entry(category_id, entry_id, def) +function doc.add_entry(category_id, entry_id, def) local cat = doc.data.categories[category_id] if cat ~= nil then local hidden = def.hidden or (def.hidden == nil and cat.def.hide_entries_by_default) @@ -434,7 +434,7 @@ function doc.get_selection(playername) end end --- Template function templates, to be used for build_formspec in doc.new_category +-- Template function templates, to be used for build_formspec in doc.add_category doc.entry_builders = {} -- Inserts line breaks into a single paragraph and collapses all whitespace (including newlines) -- cgit v1.2.3