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