# Guide Lua Objects

<details>

<summary>Guide Lua Objects</summary>

### **List of most used objects with their functions** All methods are available on **data/lib/core/**

* **Items:**
* ```
  Reference: data/lib/core/item.lua

  Item.getType(self)
  Item.isContainer(self)
  Item.isCreature(self)
  Item.isMonster(self)
  Item.isNpc(self)
  Item.isPlayer(self)
  Item.isTeleport(self)
  Item.isTile(self)
  Item.setDescription(self, description)
  Item.setText(self, text)
  Item.setUniqueId(self, uniqueId)

  Source methods

  Item:isItem()
  Item:getParent()
  Item:getTopParent()
  Item:getId()
  Item:clone()
  Item:split()
  Item:remove()
  Item:getUniqueId()
  Item:getActionId()
  Item:setActionId()
  Item:getCount()
  Item:getCharges()
  Item:getFluidType()
  Item:getWeight()
  Item:getSubType()
  Item:getName()
  Item:getPluralName()
  Item:getArticle()
  Item:getPosition()
  Item:getTile()
  Item:hasAttribute()
  Item:getAttribute()
  Item:setAttribute()
  Item:removeAttribute()
  Item:getCustomAttribute()
  Item:setCustomAttribute()
  Item:removeCustomAttribute()
  Item:moveTo()
  Item:transform()
  Item:decay()
  Item:serializeAttributes()
  Item:moveToSlot()
  Item:getDescription()
  Item:hasProperty()
  Item:getImbuementSlot()
  Item:getImbuement()
  Item:setDuration()
  Item:isInsideDepot()
  Item:getTier()
  Item:setTier()
  Item:getClassification()
  ```
* **Tiles:**
* ```
  Reference: data/lib/core/tile.lua

  Tile:isWalkable(pz, creature, floorchange, block, proj)
  Tile:isRopeSpot()

  Tile.isCreature(self)
  Tile.isItem(self)
  Tile.isTile(self)
  Tile.isContainer(self)
  Tile.relocateTo(self, toPosition)
  Tile.isHouse(self)
  Tile.isPz(self)
  ```
* **Positions:**
* ```
  Reference: data/lib/core/position.lua

  Position:getNextPosition(direction, steps)
  Position:moveUpstairs()
  Position:isInRange(from, to)
  Position:moveDownstairs()
  Position:getDistanceBetween(position)
  Position:compare(position)
  Position:hasCreature(teleportTo)
  Position:hasItem(itemId)
  Position:transformItem(itemId, itemTransform, effect)
  Position:createItem(itemId, effect)
  Position:removeItem(itemId, effect)
  Position:relocateTo(toPos)
  Position:isProtectionZoneTile()

  Position.getTile(self)
  Position.hasPlayer(centerPosition, rangeX, rangeY)
  Position.removeMonster(centerPosition, rangeX, rangeY)
  Position.getFreePosition(from, to)
  Position.getFreeSand()
  Position.getDirectionTo(pos1, pos2)
  Position.hasCreatureInArea(fromPosition, toPosition, removeCreatures, removePlayer, teleportTo)
  Position.revertItem(positionCreateItem, itemIdCreate, positionTransform, itemId, itemTransform, effect)
  ```
* **Self:**
* ```
  Player = {
      name = 'Test',
      level = 8
  }

  function Player:getLevel()
      return self.level
  end

  function Player:getName()
      return self.name
  end

  function Player.getLevel(self)
      return self.level
  end

  function Player.getName(self)
      return self.name
  end


  print(Player:getName()) --> PRINT: Test

  print(Player:getLevel()) --> PRINT: 8
  print(Player.getLevel(Player)) --> PRINT: 8

  print(Player.getLevel()) --> PRINT: Error
  ```

</details>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.opentibiabr.com/opentibiabr/projects/canary/tutorials/programming-and-scripting/guide-lua-objects.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
