Skip to content
This repository has been archived by the owner on Mar 14, 2020. It is now read-only.

Thing.getName

Hampus Joakim Nilsson edited this page Aug 3, 2012 · 1 revision

Returns the name of the thing.

[[String]] [[Thing]].getName()

Return Value

Returns the name of the thing. This is either the name of the item (without the count / article) or the name of the player / creature.

If you want the name of an item including the article, use Item.getLongName.

Examples

A simple command that displays the name of the item in one of the player's hands.

    local cmd = Command:new("GetItemName")
    cmd.words = "/getitemname"

    function cmd.handler(event)
        event.creature:sendNote("You are holding '" .. event.creature:getInventoryItem(SLOT_HAND) .. "'.")
    end

    -- Registers the name of the item
    cmd:register()
Clone this wiki locally