kts.GetItemInHand

Name

kts.GetItemInHand – get the current item carried by a creature (if any)

Synopsis

result = kts.GetItemInHand(creature)

Description

This returns the ItemType corresponding to the item held by the given creature, or nil if the creature is not holding an item (e.g. a vampire bat).

If the input is nil then nil is returned.

Return Value

An ItemType userdata object, or nil, is returned.

Errors

If the input is neither nil nor a valid Creature then an error is raised.

Examples

One example of using this function can be found in the Lua code for the "destroy book with wand" quest that ships with the game. When the special pentagram is hit, the code uses kts.GetItemInHand to figure out whether the knight is carrying the wand or not. See quest_funcs.lua.

See Also

kts.ItemType