OpenTibiaBR
GithubDiscordSponsor
  • Home
    • 📖Welcome!
    • 💵Donate
  • OpenTibiaBR
    • 🖥️Projects
      • 🐦Canary
        • About
        • Getting Started
          • Compiling
            • Linux
              • [Linux] Compiling Canary Sources
            • Windows
              • Visual Studio
                • [Windows][VC2022][CMake] Compiling Canary Sources
                • [Windows][VC2022][Solution] Compiling Canary Sources
              • WSL
                • [WSL] Compiling Canary Sources
          • Installing
            • aaPanel
              • [Linux] Canary + aaPanel + MyAAC
            • Docker
              • [Docker] Canary + MariaDB + MyAAC
            • Linux
              • Nginx + MariaDB + MyAAC
            • Windows
              • Uniform Server
                • [Windows][Basic] Canary + Uniform Server + MyAAC
              • XAMPP
                • [Windows][Advanced] Canary + XAMPP + MyAAC
        • Tutorials
          • Basic
            • Auto Backup Server Database
            • Auto Restart and Linux Logs
            • Custom Bestiary / Prey with Canary Monster Editor
            • Event Schedule Canary / OTServBR-Global
            • How to make a custom server with Canary
            • How to reset players in your database
            • How to secure a Linux server
            • SSL Certificates
            • Webhook Discord
            • [Outdated] Custom Bestiary / Prey
            • [Linux] Backup + Upload - Google Drive
            • [Linux] How to install Linux headers
            • VPS Linux
            • [Windows] SSL/HTTPS Certificate with XAMPP
          • Mapping
            • [Windows] Remere's Map Editor - Opening Canary / OTServBR-Global Map
            • [Windows] Remere's Map Editor - Converting map server id to client id
          • Programming & Scripting
            • How to add a new vocation
            • Revscriptsys
            • Guide Lua Objects
            • How to get raceId for monsters
          • Websites
            • [Canary][OTServBR-Global][GesiorAAC][MyAAC] Set up Initial Character
          • Miscellaneous
            • Useful Tutorials
            • Video Tutorials
      • 🗺️Remere's Map Editor
        • About
        • Getting Started
          • Linux
            • [Linux] Compiling Remere's Map Editor Sources
          • Windows
            • WSL
              • [WSL] Compiling Remere's Map Editor Sources
            • Visual Studio
              • [Windows][VC2022][CMake] Compiling Remere's Map Editor Sources
              • [Windows][VC2022][Solution] Compiling Remere's Map Editor Sources
      • 🎮OTClient Redemption
        • About
        • Getting Started
          • Android
            • [Android] Compiling OTClient Redemption Sources
          • Linux
            • [Linux] Compiling OTClient Redemption Sources
          • Windows
            • WSL
              • [WSL] Compiling OTClient Redemption Sources
            • Visual Studio
              • [Windows][VC2022][CMake] Compiling OTClient Redemption Sources
              • [Windows][VC2022][Solution] Compiling OTClient Redemption Sources
          • Web
            • [Web] OTClient Redemption
        • Tutorials
          • Basic
            • Client Updater
    • 🔗Downloads
      • 🎮Clients
        • Client 11
        • Client 14
          • Tutorials
            • Client with HexEditorXVI32
            • Client with Notepad++
            • Client with config.ini
            • [Windows] How to change client background
        • OTClientV8
          • About
          • Getting Started
            • Android
              • [Android] Compiling OTClientV8 Sources
            • Linux
              • [Linux] Compiling OTClientV8 Sources
            • Windows
              • WSL
                • [WSL] Compiling OTClientV8 Sources
              • Visual Studio
                • [Windows][VC2022][CMake] Compiling OTClientV8 Sources
                • [Windows][VC2022][Solution] Compiling OTClientV8 Sources
          • Features
            • Health and Mana bar backgrounds
            • HTTP support
            • OTML Improvement
            • Simple cam recorder and player
            • Updater, encryption and compression
            • WebSockets
        • Minimap
      • 📑Codes
        • C++
        • Events
        • Functions
        • Libs
        • Modules
        • Others
      • 🖼️Images
        • PSDs
        • Others
      • 🗺️Maps
        • Custom
        • Global
      • 📑Revscripts
        • Actions
        • CreatureEvents
        • GlobalEvents
        • MoveEvents
        • NPCs
        • Spells
        • Systems
        • TalkActions
      • ⚔️Sprites
      • ⚙️Tools
        • Editors
        • Launchers
          • Canary Launcher
            • About
            • Getting Started
              • Windows
                • [Windows][VC2022][Solution] Compiling Canary Launcher Sources
          • Slender Launcher
            • About
            • Getting Started
              • Windows
                • [Windows][Go] Compiling Slender Launcher Sources
        • Login Server
          • About
          • Getting Started
        • Map Generators
      • 🌐Web Packages
        • Linux
        • Windows
      • 🌐Website Applications
        • Websites
          • CanaryAAC
            • About
            • Informations
              • Features
              • Functions
              • API
              • Routes
              • Middleware
            • CanaryAAC Bot
          • Gesior2012
            • About
          • GesiorAAC Global
            • About
          • MyAAC
            • About
          • MyAAC Global
            • About
          • SlenderAAC
            • About
          • ZnoteAAC
            • About
        • Applications
        • Layouts
        • APIs and SDKs
Powered by GitBook
On this page
  1. OpenTibiaBR
  2. Projects
  3. Canary
  4. Tutorials
  5. Programming & Scripting

Guide Lua Objects

Guide Lua Objects

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
🖥️
🐦