items

Functions:

create

items.create(material: string): item

Name
Type
Description

material

string

Item material ID, supports uppercase or lowercase.

Creates a basic item. Returns an object table item .

Material IDs

create_custom

items.create_custom(material: string[, display_name: string, lore: string]): item

Name
Type
Description

material

string

Item material ID, supports uppercase or lowercase.

display_name

string

Item display name

lore

string

Item lore

Creates a custom item. Returns an object item .

create_skull

items.create_skull(owner: string[, display_name: string, lore: string]): item

Name
Type
Description

owner

string

Name of the skull owner

display_name

string

Item display name

lore

string

Item lore

Creates a skull. Returns an object item .

give

items.give(player_name: string, item: item[, amount: number]): boolean

items.give(player_name: string, material: string[, amount: number]): boolean

Name
Type
Description

player_name

string

Player`s name

item

table

Item to be given

material

string

Item to be given

amount

number

Optional. Number of items to be given. Defaults to 1.

Gives item to specific player (with overload). Returns false on failure.

remove

items.remove(player_name: string, item: item[, amount: number]): boolean

items.remove(player_name: string, material: string[, amount: number]): boolean

Name
Type
Description

player_name

string

Player`s name

item

table

Item to be removed

material

string

Item to be removed

amount

number

Optional. Number of items to be removed. Defaults to 1.

Removes item to specific player (with overload). Returns false on failure.

has

items.has(player_name: string, item: item[, amount: number]): boolean

items.has(player_name: string, material: string[, amount: number]): boolean

Name
Type
Description

player_name

string

Player`s name

item

table

Item to be checked

material

string

Item to be checked

amount

number

Optional. Number of items to be checked. Defaults to 1.

Checks if the player has a specified number of items (with overload). Returns true if the player has a sufficient number of items.

count

items.count(player_name: string, item: item): number

items.count(player_name: string, material: string): number

Name
Type
Description

player_name

string

Player`s name

item

table

Item to be checked

material

string

Item to be checked

Checks the number of items owned by the player (with overload). Returns the number of item.

clear_inventory

items.clear_inventory(player_name: string): boolean

Name
Type
Description

player_name

string

Player`s name

Clears the inventory of specific player. Returns false on failure.

set_inventory

items.set_inventory(player_name: string, items: table): boolean

Name
Type
Description

player_name

string

Player`s name

items

table

List of items to be set

Sets the inventory of specific player. Returns false on failure.

get_inventory

items.get_inventory(player_name: string): boolean

Name
Type
Description

player_name

string

Player`s name

Gets the inventory of specific player. Returns false on failure.

Methods:

🔗 item

:set_amount

item:set_amount(amount: number): item

Name
Type
Description

amount

number

Number of item to be set.

Sets the number of a specific item. Returns item itself.

:get_amount

item:get_amount(): number

Gets the number of a specific item. Returns the number of item.

:set_data

item:set_data(key: string, value: string[, namespace: string]): item

Name
Type
Description

key

string

Data key name

value

string

Data value

namespace

string

Optional. Namespace. Defaults to "luagin".

Sets persistent data for specific items. Returns item itself.

:get_data

item:get_data(key: string[, namespace: string]): string

Name
Type
Description

key

string

Data key name

namespace

string

Optional. Namespace. Defaults to "luagin".

Gets persistent data for specific items. Returns data value.

:has_data

item:has_data(key: string[, namespace: string]): boolean

Name
Type
Description

key

string

Data key name

namespace

string

Optional. Namespace. Defaults to "luagin".

Checks if the item has persistent data. Returns true if the item has persistent data.

:set_enchant

item:set_enchant(enchant: string, level: number): item

Name
Type
Description

enchant

string

Enchantment namespace key. Such as "minecraft:sharpness" or "sharpness".

level

string

Enchantment level, positive integer.

Sets the item enchantment. Returns item itself.

:set_flag

item:set_flag(flag: string): item

Name
Type
Description

flag

string

Enum ItemFlag. Such as HIDE_UNBREAKABLE.

Sets the item flag. Returns item itself.

:set_unbreakable

item:set_unbreakable(unbreakable: boolean): item

Name
Type
Description

unbreakable

boolean

Unbreakable

Sets the item unbreakable. Returns item itself.

:set_custom_model_data

item:set_custom_model_data(data: number): item

Name
Type
Description

data

number

Integer value of custom model data

Sets the item custom model data. Returns item itself.

:set_durability

item:set_durability(durability: number): item

Name
Type
Description

durability

number

Integer value of durability

Sets the item durability. Returns item itself.

:get_info

item:get_info(): iteminfo

Gets detailed information about the item. Returns iteminfo struct.

Structs:

ℹ️ iteminfo

type

iteminfo.type : string

amount

iteminfo.amount : number

max_stack_size

iteminfo.max_stack_size : number

display_name

iteminfo.display_name : string

lore

iteminfo.lore : tabel

Array, index is the row, value is the content string of the row.

enchantments

iteminfo.enchantments : tabel

Key value pairs, where the key is an enchanted name string and the value is a level number.

unbreakable

iteminfo.unbreakable : boolean

Last updated