Wizards of Lua

The Art of Spell Crafting


Items - Creating Items

The Items module can be used to create an item of any type.

Here is an overview of the Items functions:

Function Parameters Results
 get  name, amount Item

Functions

Below you find short descriptions about each of the functions and some examples about how to use them in your spells.


get (name, amount) -> Item

The ‘get’ function returns a new item of the given type and amount.

Example

Creating one diamond axe and putting it into the player’s hand.

local axe = Items.get("diamond_axe")
spell.owner.mainhand = axe

Example

Creating a full stack of wheat and putting it into the wizard’s hand.

spell.owner.mainhand = Items.get("wheat", 64)