Module api.lua

API

Functions

server_shop.currency_is_registered () Checks if there are registered currencies in order to give refunds.
server_shop.get_currencies () Retrieves registered currencies & values.
server_shop.register_currency (item, value) Registers an item that can be used as currency.
server_shop.format_id (id) Checks ID string for invalid characters.
server_shop.register_seller (id, name, products) Registers a seller shop.
server_shop.register_buyer (id, name, products) Registers a buyer shop.
server_shop.register_shop (id, name, products, buyer) Registers a shop.
server_shop.get_shop (id, buyer) Retrieves shop product list.
server_shop.is_registered (id, buyer, true) Checks if a shop is registered.
server_shop.is_shop_admin (player) Checks if a player has admin rights to for managing shop.
server_shop.is_shop_owner (pos, player) Checks if a player is the owner of node.


Functions

server_shop.currency_is_registered ()
Checks if there are registered currencies in order to give refunds.

Returns:

    bool true if at least one currency item is registered.
server_shop.get_currencies ()
Retrieves registered currencies & values.

Returns:

    table Registered currencies.
server_shop.register_currency (item, value)

Registers an item that can be used as currency.

TODO:

  • after registering currency, should re-organize table from highest value to lowest

Parameters:

  • item string Item name.
  • value int Value the item should represent.
server_shop.format_id (id)
Checks ID string for invalid characters.

Parameters:

  • id string Shop identifier string.

Returns:

    string Formatted string.
server_shop.register_seller (id, name, products)
Registers a seller shop.

Parameters:

  • id string Shop string identifier.
  • name string Human readable name.
  • products table[string,int] List of products & prices in format {item_name, price}.
server_shop.register_buyer (id, name, products)
Registers a buyer shop.

Parameters:

  • id string Shop string identifier.
  • name string Human readable name.
  • products table[string,int] List of products & prices in format {item_name, price}.
server_shop.register_shop (id, name, products, buyer)
Registers a shop.

Added for backwards compatibility.

Parameters:

  • id string Shop string identifier.
  • name string Human readable name.
  • products table[string,int] List of products & prices in format {item_name, price}.
  • buyer bool Denotes whether to register seller or buyer shop (default: false (seller)).
server_shop.get_shop (id, buyer)
Retrieves shop product list.

Parameters:

  • id string String identifier of shop.
  • buyer bool Denotes whether seller or buyer shops will be parsed (default: false).

Returns:

    table Table of shop contents.
server_shop.is_registered (id, buyer, true)
Checks if a shop is registered.

Parameters:

  • id string Shop string identifier.
  • buyer bool Denotes whether to check seller or buyer shops (default: false).
  • true bool ` if the shop ID is found.
server_shop.is_shop_admin (player)
Checks if a player has admin rights to for managing shop.

Parameters:

  • player Player requesting permissions.

Returns:

    true if player has server priv.
server_shop.is_shop_owner (pos, player)
Checks if a player is the owner of node.

Parameters:

  • pos Position of shop node.
  • player Player to be checked.

Returns:

    true if player is owner.
generated by LDoc 1.4.6 Last updated 2021-06-10 17:47:50